|
-
April 30th, 1999, 02:21 AM
#1
disabling pushbutton through code
Hi,
how to disable a push button control through code. If anyone knows please inform. Thank you bye.
-
April 30th, 1999, 02:23 AM
#2
Re: disabling pushbutton through code
Assuming that the button's control ID is IDC_MYBUTTON, you can do the following:
GetDlgItem(IDC_MYBUTTON)->EnableWindow(FALSE);
If you want to completely hide the button from view, you can do this:
GetDlgItem(IDC_MYBUTTON)->ShowWindow(SW_HIDE);
And to restore the button to view, do this:
GetDlgItem(IDC_MYBUTTON)->ShowWindow(SW_SHOW);
Hope this helps! Good luck!
- Troy
-
April 30th, 1999, 02:29 AM
#3
Re: disabling pushbutton through code
Hi,
connect Your button with a member variable of Your dialogclass (assuming You're using a dialog...) and call ModifyStyle(0, WS_DISABLED). The next time the button is drawn, it is drawn as disabled (You might want to redraw it immediately, because until then it IS disabled even if it doesn't look so).
HTH
Rudolf
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
|