From: Mattia B. <mb...@ds...> - 2001-12-19 18:13:22
|
Sorry for the delay > > 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. the trouble is that in perl you can only have scalar references, so you need a flag to tell the class you want a number/string/bool transferred > > 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). the one I wrote in C++ a year ago could: * check that the number is aproper integer number ( if you passed a int/long pointer ) * check that the number is a proper float number ( if you passed a float/double pointer ) * optionally check that the number is in some range > > 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 > > 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 > > NumericValidator ) > > BTW this example does not fit with Perl ( because in Perl a > > number "is" a string, but I hope you get the idea ) > > > Hmm... Have looked at the C++ code for the GV, and see what you mean > with comboboxes. > > 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. See my other mail. Thanks! Mattia |