Buttons
-
For the buttons on my dialog based application I need to have an implementation of the OnLButtonDown and OLButtonUp methods so that I know when the mouse is in different 'click' states. Looking at the available control events these aren't availble (only available for the actual dialog). Is there a way to do this? TIA, Andy
-
For the buttons on my dialog based application I need to have an implementation of the OnLButtonDown and OLButtonUp methods so that I know when the mouse is in different 'click' states. Looking at the available control events these aren't availble (only available for the actual dialog). Is there a way to do this? TIA, Andy
Derive a class from CButton and attach it to the buttons in the dialogs OnInitDialog function (or use DDX_Control to do it in DoDataExchange but you'll have to add the DDX_Control manually outside of AFX_DATA_MAP or use the class wizard to create a member variable for the button using CButton and then move them out of AFX_DATA_MAP and modify the declaration from CButton to CMyButton if you use class wizard to derive CMyButton then class wizard actually recognizes it as a valid variable type I didnt know this), then you can add WM_LBUTTONUP/DOWN handlers to your CMyButton class. -- modified at 6:42 Monday 15th October, 2007
-
Derive a class from CButton and attach it to the buttons in the dialogs OnInitDialog function (or use DDX_Control to do it in DoDataExchange but you'll have to add the DDX_Control manually outside of AFX_DATA_MAP or use the class wizard to create a member variable for the button using CButton and then move them out of AFX_DATA_MAP and modify the declaration from CButton to CMyButton if you use class wizard to derive CMyButton then class wizard actually recognizes it as a valid variable type I didnt know this), then you can add WM_LBUTTONUP/DOWN handlers to your CMyButton class. -- modified at 6:42 Monday 15th October, 2007
-
Hi, thanks for your reply, I'm having a bad start to the day so could you post a link to an article (or explain) how I can overload the CButton class? cheers,
-
-
Hi, thanks for your reply, I'm having a bad start to the day so could you post a link to an article (or explain) how I can overload the CButton class? cheers,
Use ClassWizard (Ctrl+W). In the Base class combobox, select
CButton
.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne