[openbeos] BWindow->AddChild(view, sibling!=NULL) bug

  • From: "Zenja Solaja" <solaja@xxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Tue, 8 Aug 2006 10:46:09 +0000

<sorry if duplicate, GMail problem>

Morning/afternoon/evening

We seriously need to set up a Haiku mailing lists similar to
BeDevTalk/BeCodeTalk (the bug-br mailing list is not really affiliated with
Haiku) for code help (Haiku/BeOS related).


QUESTION Is this a BeOS bug (hence also replicated in Haiku)?

EXPLANATION
I have 2 views which I wish to add to a window.  One is a background view
covering the enitre window, while the second view has some controls.
According to BeBook:

void AddChild(BView *aView, BView *sibling=NULL);

AddChild() places aView (and its child views) in the window, adds it to the
window's view list, and adds it to the window's list of handlers. In the
window's view list, aView is inserted before sibling. If sibling is NULL,
aView is added at the end of the list. Note, however, that window list order
is of little significance; for example, it doesn't affect the order in which
sibling views are drawn.  aView and its children are added to the window's
handler list; aView's next handler is set to this BWindow.

My test code:

AddChild(background_view);
AddChild(control_view, background_view);

If I use ChildAt(index), it actually shows that control_view is inserted
before background view.  However, messages are sent to background view
first, not control_view.

If I reverse the order:

AddChild(control_view);
AddChild(background_view);

Using ChildAt(index), I can verify that control_view is inserted before
background view.  Now control_view receives messages first (which is what I
actually want)

BUG
Even though the hierarchy is properly sent, message handling heirarchy seems
NOT to respond to insertion before sibling view, ie. it just merily adds the
handler to a list without adjusting heirarchy.

What I want is the higher view to receive messages first.  If I add the
views in the order I want, this is what I get.  If however I use the sibling
option and reverse the addchild order, even though I get the views in the
correct order, I do not get messages sent to the correct view first.

a) Is this a BeOS bug, or am I wrong?
b) if this is a BeOS bug, is it replicated in Haiku?
c) Would fixing this bug effect BeOS binary compatibility?

Finally, is it practical to have a mechanism where the OS inquires an
Application about the OS-version it was built for, and if it responds with
BeOSR5 you have one behaviour, and if it responds with HaikuR1, the OS
behaves differently?  Other than using a different library (ie. instead of
libbe.so, you link to libhaiku1.0.so), is there any other way of doing
this?  This question is really GlassElevator domain.

Back to your scheduled program....

Other related posts: