From: James L. <ja...@mi...> - 2001-12-18 11:11:52
|
> wxTextValidator is OK for Perl, while wxGenericValidator does > 1 - use overloading > wxGV construtor takes one of a int/bool/string/integer array > (C++) pointer ( think Perl references ), but in Perl > int/string/bool map to scalar. Yes, I think a Perl-implemented GenericValidator can just take the address of the variable to/from which to deposit/get data, and can handle it appropriately internally by checking the reference type. > 2 - there is no NumericValidator ( or whatever you want to call it ) > one that does a text->number conversion with error > checking/bound checking, for intehers and floats What would you like it to do? Take a mask and validate the input according to the mask? (I'm assuming there's no existing wx masked text control already). > 3 - I don't like wxGV because it tries to do > validation for all controls, doing the Right Thing, but this > sometimes is not possible ( like: for comboboxes > if you pass a string, it returns the selected string, > if you pass an integer it returns the index of the=20 > selected string in > the combobox, but if I want the selected string as a number > ( because my combobox contains, say, 1,2,3,4,6,12 ) I need > a custom validator ( this relates to the lack of a=20 > NumericValidator )=20 > BTW this example does not fit with Perl ( because in Perl a > number "is" a string, but I hope you get the idea ) >=20 Hmm... Have looked at the C++ code for the GV, and see what you mean with comboboxes. =20 Just trying to work out how we can differentiate between setting selection by index or string. In this case, I think we need a separate ComboBoxValidator (or rather ChoiceValidator), with a flag passed to the constructor indicating how we want to set the selection (index or string). In the light of this, do you think we should not have a GV, but have individual ones for each control type, or implement the GV in Perl with more intelligence? > But since I do not use validator that much, it's up to you to decide Oh goody! In terms of package/object naming, what should I do? Not sure if the Perl validators should be in the Wx namespace. Notwithstanding that, I think I should name the validators PlGenericValidator, PlChoiceValidator etc., to differentiate from the 'native' wx validators. What do you think? I don't know if there are standards already published on this in the Wx/Perl community. James |