Solved

Disable all child window controls(ie. grayout)

Posted on 1998-01-25
1
351 Views
Last Modified: 2013-11-20
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;
etc...

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.

Thanks
Venkatesan Pillai
Senior Software Engineer, Autodesk Inc
San Rafael, CA 94903
Venkatesan.Pillai@autodesk.com

0
Comment
Question by:dvenkat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 23

Accepted Solution

by:
chensu earned 30 total points
ID: 1314764
You can use CWnd::GetNextDlgTabItem() and/or CWnd::GetNextDlgGroupItem() to enumerate all the child controls. Pass NULL as the pWndCtl parameter to get the first control.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question