Solved

DoModal() problem

Posted on 1998-05-13
5
356 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
[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
  • 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

695 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