Overloading MFC's Button ..?
Hi All,
I known that there a way of overloading CButton of MFC librairies.
But i dont kown how to make my overloaded Class used by my application''s Buttons ?
Can Someone Help...
Thanks
September 26, 2000 11:11 AM
class CMyButton : public CButton { //: ...include method overrides ..};[/source]Then your application will use instances of CMyButton instead of CButton.For instance:[source]class CMyButtonDlg { CMyButton m_cmdButton1;};
I get the feeling I don''t understand the direction of your question..
Thanks, but it''s dont seem to work ...
What i really want, it to replace the normal grey button, by my own type of Button.
So i want to overload the current CButton class, and add it,some reference to picture from my Program Resource !! So this class will be able to deal with Picure Button !!
Sound Great ...
Ya, Oups, ...
It''s dont seem to work ''cause i cannot find any declaration of Button and/or Any other type of controls in my MFC Program !!
Thanks...
LowRad
What i really want, it to replace the normal grey button, by my own type of Button.
So i want to overload the current CButton class, and add it,some reference to picture from my Program Resource !! So this class will be able to deal with Picure Button !!
Sound Great ...
Ya, Oups, ...
It''s dont seem to work ''cause i cannot find any declaration of Button and/or Any other type of controls in my MFC Program !!
Thanks...
LowRad
Ah. You have the new button all written, but you don''t know how to actually put it on your dialog hmm?
First you need to make your button. Since it''s derived from CButton, you can put a plain normal button on your dialog in your resource editor. Right click on that button, and go into Class Wizard. Click the member variable tab, and find your button''s ID. Make a new member variable, type control, for that button. Your only choice of the type should be CButton, which is fine. Go ahead and add that.
Once you have that done, go to your dialog or view''s header file. Include the header file of your new derived button class. Go into the grey stuff where the controls are defined (it''s okay to edit grey stuff even if M$ has a comment warning you, really it is...) and find the button you just declared. Replace the "CButton" with the class name of your button.
Hit compile, should work... provided of course that there''s nothing else wrong.
-fel
First you need to make your button. Since it''s derived from CButton, you can put a plain normal button on your dialog in your resource editor. Right click on that button, and go into Class Wizard. Click the member variable tab, and find your button''s ID. Make a new member variable, type control, for that button. Your only choice of the type should be CButton, which is fine. Go ahead and add that.
Once you have that done, go to your dialog or view''s header file. Include the header file of your new derived button class. Go into the grey stuff where the controls are defined (it''s okay to edit grey stuff even if M$ has a comment warning you, really it is...) and find the button you just declared. Replace the "CButton" with the class name of your button.
Hit compile, should work... provided of course that there''s nothing else wrong.
-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement