Solved

DoModal() problem

Posted on 1998-05-13
5
348 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

815 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

9 Experts available now in Live!

Get 1:1 Help Now