Basic Question
-
Hi All, If I place a button in a dialog box, my perception is that the button should be the part of my dialog class. But when I see my dialog box there is no Button object. How can I access that Button object. I need that object because I want to enable and disable that button according to some condition. I also want to attach toottip to that button. Please let me know if further clarification is required.
Suraj
-
Hi All, If I place a button in a dialog box, my perception is that the button should be the part of my dialog class. But when I see my dialog box there is no Button object. How can I access that Button object. I need that object because I want to enable and disable that button according to some condition. I also want to attach toottip to that button. Please let me know if further clarification is required.
Suraj
Gupta Suraj wrote:
How can I access that Button object. I need that object because I want to enable and disable that button according to some condition.
You need to associate a variable with the button (how to do this depends of which IDE you are using). The variable type must be a CButton in order to access functionalities of your button.
Cédric Moonen Software developer
Charting control [v1.1] -
Gupta Suraj wrote:
How can I access that Button object. I need that object because I want to enable and disable that button according to some condition.
You need to associate a variable with the button (how to do this depends of which IDE you are using). The variable type must be a CButton in order to access functionalities of your button.
Cédric Moonen Software developer
Charting control [v1.1]Other way is.... CWnd *pWnd = GetDlgItem( IDC_BUTTON/* Ur Button ID */); pWnd->EnableWindow( FALSE );//Disable the button pWnd->EnableWindow( TRUE );//Enable the button
-
Hi All, If I place a button in a dialog box, my perception is that the button should be the part of my dialog class. But when I see my dialog box there is no Button object. How can I access that Button object. I need that object because I want to enable and disable that button according to some condition. I also want to attach toottip to that button. Please let me know if further clarification is required.
Suraj
Gupta Suraj wrote:
my perception is that the button should be the part of my dialog class.
Dialog class will be based on dilaog template resource, button would be part of that resource.
Gupta Suraj wrote:
How can I access that Button object. I need that object because I want to enable and disable that button according to some condition.
Apart from method Cedric has suggested, you can use
GetDlgItem
function for accessing controls on dialog,too.GetDlgItem(IDC_MYBUTTON)->EnableWindow(FALSE);
Prasad Notifier using ATL | Operator new[],delete[][^]
-
Hi All, If I place a button in a dialog box, my perception is that the button should be the part of my dialog class. But when I see my dialog box there is no Button object. How can I access that Button object. I need that object because I want to enable and disable that button according to some condition. I also want to attach toottip to that button. Please let me know if further clarification is required.
Suraj
If u r using VC++ Put the button in the Dialog. Right Click on it and select "add variable" Select access type (public/private) Select Variable type (CButton) Give a variable name (ex: m_buttonHello) Now in the source file (.cpp) for dialog class write: m_buttonHello.EnableWindow(TRUE) or m_buttonHello.EnableWindow(FALSE) wherever necessary Cheers ;)