Sign in to follow this  

Posting messages through a hierarchy

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 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 shouldn't be that hard, but I keep on confusing myself when trying to think of how to do 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this