On 3/20/2015 3:46 PM, jp charras wrote:
> Le 20/03/2015 20:39, Wayne Stambaugh a écrit :
>> Hmm!?  Where have I heard this before?  The more times I see this, the
>> more seriously I'm thinking of creating a policy where kicad dialogs
>> must use the proper wxWidgets methods for transferring data to and from
>> the dialog controls (see
>> http://docs.wxwidgets.org/3.0/overview_validator.html) and making the
>> wxID_OK and wxID_CANCEL event handlers we currently use a shooting
>> offense. :)
> 
> Yes, you are right: some of our dialogs could use the default wxWidgets
> handlers for the OK and Cancel buttons.
> For some of them, I am the culprit...
> Sorry.
> 
> 

Please don't use the default ok and cancel event handlers unless you
need to override the default behavior (which we typically don't).
Override TransferDataToWindow and TransferDataFromWindow and/or use
wxValidators for data transfer.  The default ok and cancel event
handlers in wxDialog are already hooked in to this using these methods
for transferring data to and from the dialog controls.  When you create
a new event handler for ok and/or cancel, you completely bypass this
mechanism.  I have a copy of "Cross-Platform GUI Programming with
wxWidgets" book by Julian Smart (one of the wxWidgets founders) which
has an excellent section on dialog data transfer but you can get the
general idea of how this works by reading the validator overview in the
wxWidgets documentation and digging around the wxWidgets source code.
Using the correct data transfer method means that you do not have to
keep track of the dialog modality.  It's already done for you.


_______________________________________________
Mailing list: https://launchpad.net/~kicad-developers
Post to     : kicad-developers@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kicad-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to