Solved

DoModal() problem

Posted on 1998-05-13
5
351 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
ID: 1310333
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
ID: 1310334
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
ID: 1310335
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
ID: 1310336
HI,
Could you tell me more! I can do nothing from the early advice .
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1310337
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

827 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