Original Post
Hello.. I'm making a control library and have so far created a base class (CControl) (which everything is derived from), a Window Class (CWindow) and a Button Class (CButton).. the part i'm having a bit of trouble with is how to handle the mousemove and mousedown events different for each instance of the button class...right now the parent window gets the messages from the WndProc..and sends them to the appropriate control..which is not a problem...but say I want two buttons to do 2 different things.. This is What I would like.. the problem is since they both come from the same class, i'm not sure how to have them do different functions than each other...without having to like edit the class each time i make a new button
CWindow * ParentWindow;
CButton * button1;
CButton * button2;
MessagePump
{
switch (message)
{
case MOUSEMOVE:
case MOUSEBUTTONDOWN:
case MOUSEBUTTONUP:
PostMessages(ParentWindow, message); //parent window then relays the messages to the appropriate button
break;
}
}
button1->MouseDown()
{
do something
}
button2->MouseDown()
{
do something different than button one
}