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) -- Jean-Pierre CHARRAS _______________________________________________ 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