|
-
August 18th, 1999, 05:23 PM
#1
disabling/enableing button control
I am trying simple thing of disabling and enabling button controls in dialog. Please give me some suggestion
-
August 18th, 1999, 05:29 PM
#2
Re: disabling/enableing button control
To disable button:
GetDlgItem(IDC_BUTTON_TEST)->EnableWindow(FALSE); /* TRUE to enable */
-
August 18th, 1999, 05:33 PM
#3
Re: disabling/enableing button control
You want to use CWnd::EnableWindow() to do this.
void CDialog::somefunction()
{
CButton * myButton = (CButton *) this->GetDlgItem(idc);
myButton->EnableWindow(true); // enable the button
myButton->EnableWindow(false); // disable the button
}
idc is the IDC_ value for the control in question which you can get by going into the dialog resource editor and looking at the control's properties.
-
August 18th, 1999, 05:34 PM
#4
Re: disabling/enableing button control
-
August 18th, 1999, 05:35 PM
#5
Re: disabling/enableing button control
Thanks alot for your help. I got it.
-
August 18th, 1999, 05:40 PM
#6
Re: disabling/enableing button control
I was also trying to create and destroy buttons.
I tried using CButton::Create(). The button doesn't appear on the dialog box. And I do not know the reason. What is the right way of doing it
-
August 18th, 1999, 05:56 PM
#7
Re: disabling/enableing button control
Make sure to have a member or global variable for the control (not local to the function).
Example:
m_Button1.Create("test", WS_CHILD|WS_VISIBLE,...
or
m_pButton1 = new CButton();
m_pButton1->Create("test", WS_CHILD|WS_VISIBLE,...
make sure to delete m_pButton1 when you don't need it anymore
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|