?
Solved

Controls on Dialog

Posted on 2002-05-20
3
Medium Priority
?
171 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
In this post we will learn different types of Android Layout and some basics of an Android App.
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 we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

762 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