[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Associating a dialog box to a view

Posted on 1997-12-10
1
Medium Priority
?
196 Views
Last Modified: 2010-04-10
I have a dialog box which has some controls. I want to invoke it from a menu item in a view. Also, I want to handle the ONCOMMAND handlers of the dialog box controls in the view. When I added code for the dialog, I selected 'Select and existing class' and I selected the view class, instead of 'Add a new class'.
The problem is, in the below code, since I did not specify a separate class 'Dialog' when I built the dialog, I cannot even call the Domodal function.
void View::OnShowDialog()
{
      Dialog dlg;
      dlg.DoModal();
}
How to achieve what I want to?
Thanks.
0
Comment
Question by:pcasxd0
[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 7

Accepted Solution

by:
galkin earned 150 total points
ID: 1175760
If you want to handle command messages by view and not dialog you must do the following:
1.Pass pointer to the view to dialog constructor, and store this pointer in dialog member variable.
2.Overide OnCmdMessage for your dialog class and in this function call m_pView->OnCmdMessage, whether m_pView is pointer to view class.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
Suggested Courses

649 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