Page 1 of 1

wxCrafter and wxValidator

Posted: Sat Feb 07, 2015 1:00 pm
by iwbnwif
Hi,

I would like to use a wxTextValidator for some fields (wxTextCtrl) in a dialog which is created by wxCrafter.

The fields however are arranged on several notebook pages (wxNotebook) and therefore the text controls are children of the notebook page rather than the dialog.

In order to bind their text controls to the members of my c++ class I need to add the extra style wxWS_EX_VALIDATE_RECURSIVELY for the dialog and this needs to be done before the controls are created.

Is there a way to set this extra style using wxCrafter? I tried typing it into the wxWindow line on the "Styles" property grid but it does not persist.

Many thanks!

p.s. maybe a nice future feature would be to allow the user to type a variable name into the property grid for wxTextCtrl etc. and wxCrafter automatically binds them :)

Re: wxCrafter and wxValidator

Posted: Sat Feb 07, 2015 7:46 pm
by eranif
You could use the Subclass feature of wxDialog (it exists for all controls) or use a custom control

Eran

Re: wxCrafter and wxValidator

Posted: Sun Feb 08, 2015 12:28 am
by iwbnwif
Thank you Erin, yes that works!

I created a myDialog with SetExtraStyle (wxWS_EX_VALIDATE_RECURSIVELY) in the ctor and then subclassed the dialog in wxCrafter.

By the way, just upgraded to CodeLite 7 and wxCrafter 2 - looking good :D