From: James L. <ja...@mi...> - 2001-12-18 09:55:25
|
Dear Mattia, Thanks - this works a treat! I was so close... Anyway, now I'm up and running. I had noticed the 'Attempt to free unreferenced...' error - will await a fix. Now that I've got things working, what do you suggest/would you like? I feel that validators are the way to go when it comes to transferring data to/from controls (rather than explicit GetValue/SetValue calls all over the place) - I have had to implement a similar concept (though not as elegant) in a very large Perl/Tk application which we have developed. I see that you think we should create Perl versions of wxGenericValidator and wxTextValidator - I am happy to do this and contribute them to the project. If I do this, do you (or anyone else on the list) have ideas on how we should name/implement them? What 'better interface' can you envisage for a Perl-based Validator? I have not examined the native wxGenericValidator and wxTextValidator yet, so am interested in your thoughts. Regards, James > -----Original Message----- > From: Mattia Barbon [mailto:mb...@ds...] > Sent: 17 December 2001 22:22 > To: wxp...@li... > Subject: RE: [wxperl-users] Re: wxValidator available via wxPerl >=20 >=20 > > Dear Mattia (or others, if they can help), > > I've been delving into how to use wxValidators, and I think=20 > I understand the > > concept (and I like it!). > >=20 > > However, I'm having real trouble deriving my own validator (called, > > unimaginitively, myValidator) from Wx::PlValidator. > >=20 > > >From the wxWindows documentation, all validators must=20 > implement a Clone > > method. I have tried implementing a Clone method, which I=20 > can see getting > > called, but myValidator's Validate, TransferFromWindow, and=20 > TransferToWindow > > never seem to get called. > >=20 > > Here is my code (with the methods apart from Clone doing=20 > nothing useful > > apart from printing to STDOUT): > >=20 > > VVVVVVVVVVVVVVVVVVVV > > use Wx; > >=20 > > package myValidator; > This is OK ( in fact the sample I sant uses this code ) >=20 > > ^^^^^^^^^^^^ > >=20 > =20 > > Could you post a very simple example of how to create a=20 > validator class in > > Perl, and how to create a frame which uses it, please? > Here is your example ( modified minimal sample, use Help->About to > show the validator dialog ) >=20 > I am getting a "Attempt to free unreferenced scalar at=20 > C:/Developement/wxPerl/wxPerl/blib/lib/Wx.pm line 61.",=20 > which I was not getting when I first tested Validators. > It is obviously something I am doing wrong with reference > counting in wxPerl; will fix. >=20 > A caveat: do not use a validator after you did > ->SetValidator(); for implementation reasons, > once you do ->SetValidator() it is no more valid. >=20 > Regards > Mattia >=20 >=20 >=20 >=20 |