Solved

DoModal() problem

Posted on 1998-05-13
5
346 Views
Last Modified: 2013-11-20
I want to write a program: Dialog1 have a button (Show) and two edit box
to input x, y. When press Show, the other dialog (Dialog2) show something in
variables x, y.
Can I use DoModal() to diaplay Dialog2 . If can: How can I write something
to modal dialog.
If can not: Could you show me another way ?  

Thanks
0
Comment
Question by:nhcuong
  • 2
  • 2
5 Comments
 
LVL 1

Expert Comment

by:Blondie050798
Comment Utility
Um...I sure this question is actually quite easy, but I didn't understand it...can you clarify the question again?

Do you have a dialog (Dialog1) which is displayed with DoModal(), and on it there are 2 edit boxes (x & y) and a button (Show).  When you press Show, another dialog box is displayed (Dialog2).  Apart from that, I'm a bit confused about the relationship that you require between the two dialogs...sorry I can't help anymore yet...let me have some more details...
0
 
LVL 8

Accepted Solution

by:
gelbert earned 0 total points
Comment Utility
You have to use DoModal() to implement modal dialog. To get information into modal dialog which is up( after DoModal() call), it has to make a call to request information. You can pass in information into dialog after you created object but before call to DoModal()

CYourDlg dlg;
dlg.SetXY( x, y );
dlg.DoModal();

OR

CYourdlg::OnInitDialog()
{
   GetParent()->GetXY( &x, &y );
}
0
 

Author Comment

by:nhcuong
Comment Utility
Hi gelbert,
But SetXY is not a member of CDialog.
Hi Blondie,
I only want Dialog2 can display data of Dialog1.

0
 

Author Comment

by:nhcuong
Comment Utility
HI,
Could you tell me more! I can do nothing from the early advice .
0
 
LVL 8

Expert Comment

by:gelbert
Comment Utility
Derive your own class form CDialog and add SetXY/GetXY as a public member functions. There are only two ways to pass data into modal dialog.
First before it is up ( between construction and call to DoModal(), SetXY) and second is to request data from modal dialog (GetXY)
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Process filename extension 3 155
centeredAverage challenge 8 120
sum28 challenge 31 95
FizzBuzz challenge 9 71
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now