Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/11/2009 at 07:40, xxxxxxxx wrote:
User Information: Cinema 4D Version: 10.5 Platform: Windows ; Language(s) : C++ ;
--------- Hi.
I have programmed a CommandData Plugin. Now I want the user to enter parameters using a modal dialog.
So from the Execute() of the CommandData I call the Dialog and wait for the OK. But how can I access the values (like EDITNUMBER fields) in the modal dialog then?
I have tried (simplified) :
if (dlg.Open()) { dlg.GetLong(ID_DLG_VALUE, variable) } GePrint(LongToString(variable));
In this example variable always is zero, regardless from what I put in the EDITNUMBER field DLG_VALUE. I assume this field cannot be read anymore after the dialog is closed ... but how can I access the fields then otherwise?
Regards, Juergen
On 19/11/2009 at 09:23, xxxxxxxx wrote:
Your modal dialog will be in its own class, of course, with the header looking something like:
class MyModalDialog : public GeDialog { public: MyModalDialog(void); // dialog constructor virtual Bool CreateLayout(void); // create the dialog box virtual Bool InitValues(void); // initialise local variables virtual Bool Command(LONG id, const BaseContainer& msg); // deal with user interaction LONG theValueWanted; // public variable };
Then in the implementation, you would have something like this:
Bool MyModalDialog::Command(LONG id, const BaseContainer &msg;) { switch (id) { case IDC_BUTTONOK: // user clicked OK button // get LONG value from control GetLong(IDC_DLG_VALUE, theValueWanted); Close(); return TRUE; break; case IDC_BUTTONCANCEL: Close(); return FALSE; break; } }
Back in your main class, although the dialog is closed you can get the value you want by getting the public variable you changed:
LONG variable; variable = dlg.theValueWanted;
Sorry about the double spacing, I can't get this editor to change that!
On 23/11/2009 at 00:53, xxxxxxxx wrote:
Thanks for the reply ... this is understood. I was hoping I could work with "GeModalDialog"-class without having to overload the command-function.
Do I have to save the values in public variables in the AskClose() rather than the dialog fields, that should work as well, shouldn't it?
On 23/11/2009 at 06:11, xxxxxxxx wrote:
Yes, write the dialog values into public variables upon closing the dialog.
cheers, Matthias