Page 1 of 1

Passing variables into SetExtraControlCreator

Posted: Sun Aug 04, 2019 4:22 pm
by stevenfalco
I am following the sample dialog project, and I have added a wxTextCtrl to a saveFileDialog.

I would like to pass an initial string into the wxTextCtrl from my app, but I don't know how to do that. I tried adding a member function to "MyExtraPanel" that my app could call to pass in the string, but the panel is not created until a call to saveFileDialog.ShowModal, at which point it is too late to set the value, since the dialog has already been displayed, and the user has already clicked save or cancel.

I did a totally ugly hack, where the app puts the string into a global variable, and then "MyExtraPanel" retrieves it from the global, but there has to be a better way.

How does one pre-populate strings into MyExtraPanel?

I can post my code to dropbox if someone wants to look at it.

Re: Passing variables into SetExtraControlCreator

Posted: Sun Aug 04, 2019 5:29 pm
by doublemax
I did a totally ugly hack, where the app puts the string into a global variable, and then "MyExtraPanel" retrieves it from the global, but there has to be a better way.
Looking through the API and the source, i don't think there is any other way.

SetExtraControlCreator() and ExtraControlCreatorFunction() would have to be expanded to accept an additional parameter.

Re: Passing variables into SetExtraControlCreator

Posted: Mon Aug 05, 2019 6:50 pm
by stevenfalco
Ok - thanks for checking. I guess I'll just leave my hack in place. :D