-
July 19th, 2011, 06:13 AM
#1
Dialog box focus
Hello,
I am writing a program using VC++ with MFC,
I added some dialog boxes and I want that once one of the dialog is opened by DoModal()
all the buttons on the parent dialog will be disabled,
How can I do it?
thanks
-
July 19th, 2011, 07:13 AM
#2
Re: Dialog box focus
What's the point in that? DoModal will prevent the user from accessing all other windows anyway.
-
July 19th, 2011, 12:47 PM
#3
Re: Dialog box focus
What's the point in that? DoModal will prevent the user from accessing all other windows anyway.
Sometimes it looks nice
With GetWindow you can enumerate all the children of the dialog, and with IsKindOf you can check if the childwindow is a CButton and en/disable it. With these 2 you can make a loop that loops all the elements on a dialog and set the buttonstate.
-
July 19th, 2011, 01:29 PM
#4
Re: Dialog box focus
Originally Posted by Skizmo
S... and with IsKindOf you can check if the childwindow is a CButton and en/disable it. With these 2 you can make a loop that loops all the elements on a dialog and set the buttonstate.
I'd suggest checking windows class (using GetClassName) rather than MFC class because there may be unsubclassed buttons.
Victor Nijegorodov
-
July 19th, 2011, 02:22 PM
#5
Re: Dialog box focus
Again though, what's the point in disabling buttons you can't click on anyway?
-
July 19th, 2011, 02:27 PM
#6
Re: Dialog box focus
Originally Posted by GCDEF
Again though, what's the point in disabling buttons you can't click on anyway?
I don't know! Perhaps, OP would like to see all these buttons as disabled!?
Victor Nijegorodov
-
July 19th, 2011, 03:12 PM
#7
Re: Dialog box focus
I agree with GCDEF. It's more user-friendly to let an application behave as most other applications do. Otherwise, it's just confusing. Users may think there is something wrong with the application just because a button is disabled when they didn't expect it.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
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
|