RE: [wxperl-users] Re: wxValidator available via wxPerl #2

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:mbarbon@dsi.unive.it]
> Sent: 17 December 2001 22:22
> To: wxperl-users@lists.sourceforge.net
> 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

0
james (30)
1/23/2014 1:01:01 AM
perl.wxperl.users 3070 articles. 0 followers. Follow

3 Replies
631 Views

Similar Articles

[PageSpeed] 35

Hi everyone,

I want to use Perl2Exe to package up my application, but am having problems.

Perl2Exe runs fine, and produces a .exe file, but when I run it, I get the
following errors:

Compilation failed in require at C:\MY DOCUMENTS\PROG\TFC\PERL_SRC\TFFC.EXE
line 10.
BEGIN failed--compilation aborted at C:\MY
DOCUMENTS\PROG\TFC\PERL_SRC\TFFC.EXE line 10.

Line 10 is my 'use Wx' line.

Has anyone else succeeded in using Perl2Exe with wxPerl?

Thanks,

James


0
jlavery
1/23/2014 1:01:01 AM
> 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.
I think it is a Perl bug: putting an (empty) DESTROY in Wx::PlVlaidator make it 
disappear.
The strange thing is that base classes do not have DESTROY methods
( so it can't be the empty one masking a base class' DESTROY ),
but if you put UNIVERSAL::can( $_[0], 'SUPER::DESTROY' ); in the
previously empty DESTROY {}, this triggers the error.

Regards
Mattia

0
mbarbon
1/23/2014 1:01:01 AM
On Tue, 18 Dec 2001, James Lavery wrote:

>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.
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.
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
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 )

But since I do not use validator that much, it's up to you to decide

Thanks!
Mattia


0
mbarbon
1/23/2014 1:01:01 AM
Reply:

Similar Artilces:

RE: [wxperl-users] Re: wxValidator available via wxPerl
Mattia, Thanks, as usual, for the to-the-point and quick support! If/when I manage to produce a useful validator, I would be more than happy to submit it. Currently I'm still getting my head round how everything fits together! James > -----Original Message----- > From: Mattia Barbon [mailto:mbarbon@dsi.unive.it] > Sent: 13 December 2001 11:04 > To: wxperl-users@lists.sourceforge.net > Subject: [wxperl-users] Re: wxValidator available via wxPerl >=20 >=20 > > Dear Mattia, > > I would like to use validators in my Perl application, but=20 ...

RE: [wxperl-users] Re: wxValidator available via wxPerl
Dear Mattia (or others, if they can help), I've been delving into how to use wxValidators, and I think I understand the concept (and I like it!). However, I'm having real trouble deriving my own validator (called, unimaginitively, myValidator) from Wx::PlValidator. >From the wxWindows documentation, all validators must implement a Clone method. I have tried implementing a Clone method, which I can see getting called, but myValidator's Validate, TransferFromWindow, and TransferToWindow never seem to get called. Here is my code (with the methods apart from Clone do...

RE: [wxperl-users] Re: wxValidator available via wxPerl #3
> 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 conversio...

RE: [wxperl-users] Re: wxValidator available via wxPerl #4
Mattia, > > 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 Good point. I think I'll use the 'flag' approach. This has approach has been used elsewhere (in Win32::API, I think), so I'll try to be consistent with other modules. =20 ...

Re: [wxperl-users] Re: wxperl
yes !! its really time to help more mattia. things i could offer are beside bug reports is to help to buil a better brwosable doku, this is one of my long time wish so are so. herbert "Graciliano M. P." <gmpowers@terra.com.br> schrieb am 11.12.04 03:29:27: > > > hey all, > > > > I just tried downloading the cvs snapshot, Wx-0.20, Wx-0.19, and Wx-0.18 > > and trying to install them on solaris (without luck). I tried both > wxAll-2.4.2 > > and wxWidgets-2.5.3. > > > > Furthermore, I went to the wikis for more in...

RE: Re[4]: [wxperl-users] [OT, or maybe not?] wxPerl T-Shirt? #2
Extending this idea, we could have the ASCII art camel on a "green = screen". Then the graphical camel would be shown in three separate = windows below, one in each of the OS flavors (GTK, Win32, Mac OS X). --Toby Ovod-Everett -----Original Message----- From: Ovod-Everett, Toby=20 Sent: Monday, July 28, 2003 10:45 AM To: wxperl-users@lists.sourceforge.net Subject: RE: Re[4]: [wxperl-users] [OT, or maybe not?] wxPerl T-Shirt? What about an ASCII art camel on top (assuming O'Reilly gives a thumbs = up). Then a "use Wx;" Then a very n...

Re: [wxperl-users] wxPerl on wxX11 ? #2
> --- John Ralls <jralls@ceridwen.fremont.ca.us> wrote: > > > > > On Jul 11, 2006, at 5:31 PM, Sergei Steshenko wrote: > > > > > Hello All, > > > > > > is it possible to compile wxPerl on wxX11 rather than on wxGTK ? > > > > > > If yes, will it be functional ? > > > > > > Thanks, > > > Sergei. > > > > If wxX11 works (which is to say, if you can build it and run some of = > > the samples), then wxPerl will work fine with it. wxPerl doesn't care= ...

[wxperl-users] wxValidator available via wxPerl
Dear Mattia, I would like to use validators in my Perl application, but am not clear whether they have been wrapped. Are they available? Thanks, James Lavery MicroSec Ltd > -----Original Message----- > From: Mattia Barbon [mailto:mbarbon@dsi.unive.it] > Sent: 08 December 2001 13:31 > To: wxperl-users@lists.sourceforge.net > Subject: Re: [wxperl-users] wxPerl tutorial at the German=20 > Perl Workshop >=20 >=20 > > As you might have heard already I will be giving a half-day=20 > tutorial on > > wxPerl at the German Perl Workshop. Th...

Fwd: wxPerl on the Mac; was: [wxperl-users] Re: problems with wxPerl
>To: Jouke Visser <jouke@pvoice.org>, wxperl-users@lists.sourceforge.net >From: Christian Jaeger <christian.jaeger@sl.ethz.ch> >Subject: wxPerl on the Mac; was: [wxperl-users] Re: problems with wxPerl >Date: Sun, 30 Sep 2001 23:08:19 +0100 > >Hello, > >I'm crossposting this reply to the macosx-perl mailing list because >there is some interest, too. Actually I forgot to put the macosx-perl adress on it. >At 14:02 Uhr +0200 24.9.2001, Jouke Visser wrote: >>I wondered if anyone yet tried to compile wxPerl on a Mac. If not, I'...

Re:[wxperl-users] Re: wxPerl 0.23 release
> Mattia Barbon <mattia.barbon@libero.it> writes: > > > On Tue, 28 J= un 2005 22:44:29 +0200 Johan Vromans <jvromans@squirrel.nl> wrote:=0D = > > Under Windows the change in the default font is to > > be expected= .. > > I'm using Fedora Core 2... :-) I suppose I could not be m= ore wrong... Anyway: the font change looks like a GTK+ 1.2 vs 2.x ch= ange. For the button width you should try the wxBU_EXACTFIT style fo= r the buttons that need to be smaller than standard buttons. HTH=0D = Mattia =0A=0A=0A...

RE: Re: [wxperl-users] Re: Re: EVT_QUERY_END_SESSION
you putted the EVT_CLOSE to the wrong place... or do you have a reason why you need it to be there? $app ist not the window, but you could use EVT_CLOSE on $frame too. i changed your minimal sample that it works. hope it helps greeting Marco ---- use Wx; ########################### package MyApp; use strict; use vars qw(@ISA); @ISA=qw(Wx::App); sub OnInit { my( $this ) = @_; my( $frame ) = MyFrame->new( "Minimal wxPerl app", Wx::Point->new( 50, 50 ), Wx::Size->new( 450, 350 ) ); ...

RE: [wxperl-users] New wxPerl beta #2
> >I couldn't use your binaries since I need Wx::ActiveX. So I=20 > built Wx::ActiveX outside the wxPerl core. > > That was quite easy with your Wx::Sample::XS sample. I=20 > needed a copy of > > the main cpp/typedef.h. Did I do something wrong or is this=20 > something > > that should be included in Wx/build? > Graciliano has a new Wx::ActiveX that builds flawlessly with the new > wxPerl (and does not need cpp/typdef.h). cpp/typedef.h is not needed > anymore, and no new code should be using it. Great, are the gcc patches integrated? ...

RE: [wxperl-users] Using wxConfig in wxPerl #2
Mattia, Thanks - will await the next build/release. James > -----Original Message----- > From: Mattia Barbon [mailto:mbarbon@dsi.unive.it] > Sent: 11 December 2001 14:26 > To: James Lavery > Cc: wxperl-users@lists.sourceforge.net > Subject: RE: [wxperl-users] Using wxConfig in wxPerl >=20 >=20 > > Dear Mattia, > > I don't think there is a Wx::Config, either (at least, not on my > > machine)! =20 > Well, you are right ( and why was I so sure I had wrapped > wxConfig? ); Now in the todo for the next version. >=20 > &g...

RE: [wxperl-users] Plans for wxPerl 0.23, wxWidgets 2.6.0 #2
Hello, > I tried to compile wxPerl CVS against 2.6.0 and I got the = errors as below. > > I am compiling on WinXP using MSVC6. Should this = work? Have others > successfully compiled? Yes, but with MSVC 5 and= GCC (various versions), not MSVC 6. Are you up to date with MSVC servic= e packs? > C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils/xsubpp = -noprototypes > -nolinen <snip> > Grid.c(390) : warning C4189: 'CLAS= S' : local variable is initialized but not > referenced > Grid.c(464) := fatal error C1001: INTERNA...

Web resources about - RE: [wxperl-users] Re: wxValidator available via wxPerl #2 - perl.wxperl.users

O'Reilly Open Source Convention 2007 • July 23-27, 2007 • Portland, Oregon
O'Reilly Open Source Convention 2007 - July 23-27, 2007 - Portland, Oregon

Resources last updated: 11/25/2015 11:11:56 PM