Passing variables into SetExtraControlCreator

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
stevenfalco
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Aug 04, 2019 4:11 pm

Passing variables into SetExtraControlCreator

Post by stevenfalco » Sun Aug 04, 2019 4:22 pm

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.

User avatar
doublemax
Moderator
Moderator
Posts: 13873
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Passing variables into SetExtraControlCreator

Post by doublemax » Sun Aug 04, 2019 5:29 pm

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.
Use the source, Luke!

stevenfalco
In need of some credit
In need of some credit
Posts: 2
Joined: Sun Aug 04, 2019 4:11 pm

Re: Passing variables into SetExtraControlCreator

Post by stevenfalco » Mon Aug 05, 2019 6:50 pm

Ok - thanks for checking. I guess I'll just leave my hack in place. :D

Post Reply