Solved

Controls on Dialog

Posted on 2002-05-20
3
166 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
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 50 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Include multiple hostnames in this command? 3 55
conditional code and condition difference 9 82
Unix Command -- Challenging  question 7 90
Change to event 1 112
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

777 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