On 4/11/2016 11:01 AM, Tomasz Wlostowski wrote: > On 11.04.2016 16:57, Wayne Stambaugh wrote: >> On 4/11/2016 10:39 AM, jp charras wrote: >>> Le 11/04/2016 16:07, Wayne Stambaugh a écrit : >>>> On 4/11/2016 9:43 AM, jp charras wrote: >>>>> Le 11/04/2016 15:12, Nick Østergaard a écrit : >>>>>> In addition I would vote for a proper validator that accepts units. We >>>>>> already have the feature to enter 42.34 mm even if you are in inch >>>>>> mode globally. With the wxvalidator you can not enter letters at all, >>>>>> and hence not the unit. >>>>> >>>>> For this feature, see: >>>>> double DoubleValueFromString( EDA_UNITS_T aUnits, const wxString& >>>>> aTextValue ); >>>>> It accepts units and both separators in the text value (for angles, >>>>> degrees or radians). >>>> >>>> This isn't a validator. DoubleValueFromString() has to be called after >>>> the data is entered into the text control. Properly designed validators >>>> will filter illegal characters and display error messages if the >>>> validation fails. It's a much cleaner design. Eventually I would like >>>> to see most if not all of our dialogs use validators. We just need to >>>> create a decent set of stock validators that handle the data entry we >>>> use. Once we have a decent set of stock validators, it should be fairly >>>> trivial to fix our dialogs. >>>> >>> >>> Of course, it is not a validator, but shows what a good validator should >>> accept. >>> >>> Just when creating validators for values (coordinates, angles) keep in mind >>> the presence of units, >>> taking in account the I18n constraints. >>> A validator for coordinates and angles is more complicated than the >>> wxValidators from wxWidgets, if >>> we want to specify units in values (I have to say I do not use this >>> feature, but it currently exists) > > Hi Wayne, > > Just my 5 cents - I once wrote a class called WX_UNIT_BINDER (used in > the P&S dialogs) which manages a text input field along with its unit > label (according to current units settings). Maybe it could be extended > with proper validation and used for all coordinate/dimension inputs? > > Tom >
Hey Tom, This would be fine if we didn't already have the wxValidator plumbing in place. I would rather take advantage of the validation and transfer code already provided by wxWidgets rather than reinvent the wheel. Cheers, Wayne _______________________________________________ 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