Jump to content
  • Advertisement
Sign in to follow this  

Posting messages through a hierarchy

This topic is 4969 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, i've been working on this control library, and recently decided that I want to have multiple levels...such as a parent window can have many children (like buttons, labels, scrollboxs) and then those controls can also have children..(like nested windows ) and so forth.. so I up my base class somewhat like this
class CControl
CControl * m_Parent;
CControl * m_ChildControls;
CControl * m_NextSibling;
CControl * m_PrevSibling;
where my problem comes is posting messages (such as like mouse click events) to all my controls...in my WndProc I have the following
CControl * g_Window;

//later on
LRESULT CALLBACK WndProc(blahblahblah)
g_Window->PostMessageToAll(msg, wparam, lparam, data)
the part that I cannot come up with is the PostMessageToAll function...it shouldn't be that hard, but I keep on confusing myself when trying to think of how to do it..so i'm wondering if anyone of you have an idea how to do this.. where it would post in a top down manner...whereas the parent gets the message first, then the children and sibling..then the grandchildren ...then after that I think I need to be able to post the messages in reverse too for painting I'm sorry if I explained that really bad, but if anyone has an idea what i'm talking about please respond.. Thanks

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!