On Sun, Jun 03, 2012 at 05:49:20PM +0200, Barrett wrote: > The first thing is about BWindow deletion, i've added a configuration > window to People...my intention is to check if the window is already > opened before to create a new window, and decide on what to do. My > first solution was to just set the BWindow object to NULL and then > check if it's NULL or not...this seems to me the more natural way to > do it, since the bebook says that the BWindow auto delete itself...i > assumed that closing a BWindow using the rectangle in the window tab > will have the result of deleting the object. > Actually this work, but unfortunately only one time...after the window > is closed, checking the object for NULL will return false and the > program crash since the object isn't already valid. Am i doing > somethng bad? Deleting an object doesn't mean all pointers are magically reset to NULL, you have to do that yourself. > > The second problem is about showing a BWindow without making it the > current focus, i've tried a lot of combinations of Show(), Hide(), > Minimize() ecc. but still i was unable to do it. I've also tried, with > suggestions of someone in irc, to make it MODAL and FLOATING but i had > not success also this time...i have the suspect that it's another > BeAPI limitation (i.e. to show a window without making it the current > focus is not possible)...any ideas? Use the flag B_AVOID_FOCUS maybe ? Set the flag, then raise the window, then unset the flag so the user can focus it again ? > > The third problem come up because i'm trying to create a customized > BTextControl that show a label inside the control rectangle and when a > user click on it disappear. The first idea i had, was to use the > BView::MakeFocus() and BView::IsFocus() functions, but then i've > realized that it's not so simple...from the BeBook : > > "Note that the BTextControl itself never becomes the focus view, so > will return false to all IsFocus() queries." > > The main problem in this case is that i can't check when the user > click on the BTextView to remove such label, is this another > limitation? I think it's the case where something similar to a > signal/slot system could help a lot... Are you sure you need a BTextControl ? I think what you want to do is at the BTextView level. You can override the BTextView draw method as such : * If the view has focus, call the parent BTextView::Draw(), * If not, draw your custom text instead. While I'm at it, I noticed another bug in Caya, when I disable the window getting focus when receiving a message, the window isn't shown at all when a new conversation starts. So the setting is unusable both ways : either it steals focus from other apps all the time, or the window never opens. -- Adrien.