Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Controls on Dialog

Posted on 2002-05-20
3
Medium Priority
?
172 Views
Last Modified: 2013-11-20
Hi,

I have a question regarding controls on dialog. Controls on dialog can not catch some windows standard messages. I know one solution is to subclass the controls. But if I have many controls on a dialog, this solution will not be good because I need to subclass too many controls. Is there any good solution for this kind of purpuse? Thank you very much for your help!
0
Comment
Question by:yeshengl
[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
3 Comments
 
LVL 3

Expert Comment

by:Crius
ID: 7024372
Well, if you need to controls to do anything other than standard default behaviour (including capturing messages and processing them their own way), you really should derive some child class from the control base class.

This is the best way to do it. Replace all dialog controls you need altered with your own implementation, and anything you don't want changed in the control, don't override its function...
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 150 total points
ID: 7024461
I agree with Crius ... even I don't see why it shouldn't be good to subclass
a large number of controls except you have the work to implement none-
standard behavior for each subclassed control-type ... but you'll have to
do this anyway.
0
 
LVL 1

Expert Comment

by:gurly
ID: 7026771
One more thing -
You don't have to explicitly subclass the control (by calling the SubclassDlgItem function).
You can use the same method MFC uses to attach the control to a data member:
A. declare the data memeber in your h file as an object of the derived class (e.g: CMyEdit m_YourMember).
B. In the DoDataExchange function call:
DDX_Control(pDX, ID_YOUR_CONTROL, m_YourMember)
This call will attach the data member to the control and prevent the need for subclassing.

Good luck
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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 …
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.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

610 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