Disable all child window controls(ie. grayout)
Posted on 1998-01-25
I need to disable all the child controls in a window (say dialog).
For example, say I have a CMyDialog (derived from CDialog) class having
CComboBox myCombo1; ... myCombo100;
CListBox myListBox1; ... myListBox100;
All these variable number of combo, listbox, edit controls get displayed in the Dialog.
At run time I need to Gray them out (disable) them.
What is the most generic way of doing that? (I know myComboBox->EnableWindow(False) etc.. but it won't work in my case because I donot want to hardcode these variable names in my program to diable them.
I want to know a generic way of sending message to ALL visible child controls of a dialog to diable (& grayout) themself.
Any code sample would be very helpful.
Senior Software Engineer, Autodesk Inc
San Rafael, CA 94903