Dialog in Dialog
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2012 at 06:52, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Without a working example to learn from. I'm not going to be able to figure this one out just from hints & tips.Thanks for the help,-ScottA
Here you go Scott. A bare-bones example of how to open one dialog from another. Should just compile and run.
Download the archive with source and resource files here.
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2012 at 08:26, xxxxxxxx wrote:
You're a life saver Steve.
Thank you.Working examples are the very best way to communicate ideas with other people. Especially with C++ freshman like me. Who aren't quite as strong with the lingo sometimes.
So anything you guys do that ends up in more examples being available would be a wonderful thing.Instead of "Show me money". My catch phrase is "Show me the code".
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2012 at 09:56, xxxxxxxx wrote:
One last question Steve,
I'm trying to figure out how to make these two dialogs communicate with each other.
I have a EditText() gizmo in the main dialog. And a EditText() gizmo in the secondary dialog.
What I'm trying to do is type something in the secondary dialog's texbox. Then when it closes it updates the textbox in the main dialog.I had thought I could do it like this: dlg_2nd.GetLong(IDC_EDIT1);
But that doesn't work. It only works to open the second dialog.How do I get two different dialogs. That each have their own resources. To communicate with eachother?
-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2012 at 16:31, xxxxxxxx wrote:
A quick and dirty way to do this would be to create a class-level public variable in the secondary dialog that would hold the string from the text box in the secondary dialog. Then when the secondary dialog closes, copy the text from the edit box into this variable.
Back in the main dialog, just read the value of that variable and copy it into the edit box you have there. Code goes something like this:
// in secondarydialog.h: class SecondaryDialog : public GeModalDialog { public: String textLine; // then the rest of the functions as before }; // in secondarydialog.cpp Bool SecondaryDialog::Command(LONG id, const BaseContainer &msg;) { switch (id) { case IDC_BUTTON_CLOSE_2ND: GetString(IDC_EDIT1, textLine); Close(TRUE); return TRUE; break; } } // in maindialog.cpp Bool MainDialog::Command(LONG id, const BaseContainer &msg;) { switch(id) { // open secondary dialog case IDC_BUTTON_OPEN_2ND: dlg_2nd.Open(); SetString(IDC_YOUREDITBOX, dlg_2nd.textLine); break; } return TRUE; }
Note that this works fine here because the secondary dialog is modal, so the call to dlg_2nd.Open() doesn't return until dlg_2nd closes. Handling this communication for two non-modal dialogs would be different (and harder). But it could be done.
Steve
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 15/03/2012 at 17:12, xxxxxxxx wrote:
Works good.
Thanks for taking the time to help me with this. I know you're busy with other things.
You've been a big help.-ScottA
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 16/03/2012 at 04:54, xxxxxxxx wrote:
No problem Scott. Glad to be of help.
Steve