|
From: Mark W. <ma...@ne...> - 2006-10-17 15:36:02
|
Hi Peter,
Whenever I load resources from XRC I use the 2 step creation process:
my $newFrame = Wx::Frame->new;
$xrc->LoadOnFrame($newFrame, undef,'ID_FRAME');
Hope this help
Mark
> -----Original Message-----
> From: wxp...@li...
> [mailto:wxp...@li...] On Behalf
> Of Peter Gordon
> Sent: 17 October 2006 02:30 PM
> To: wxp...@li...
> Subject: [wxperl-users] Advice needed
>
> In the example below, I create a new Frame, where the frame
> definition is given in an xrc file. Normally, a new frame
> would give a HASH reference, whereas LoadFrame gives a SCALAR
> reference.
>
> So the question arises: I have some private data, var, that I
> would like to store in this class. How do I do it?
> $newFrame->{var} = $var fails because of the scalar reference.
>
> Thanks,
>
> Peter
>
> package MyFrame;
> use vars qw(@ISA);
>
> @ISA = qw(Wx::Frame);
>
> use Wx qw(:everything);
> use Wx::Event qw(:everything) ;
>
> sub new {
> my $xrc = Wx::XmlResource->new();
> $xrc->InitAllHandlers();
> $xrc->Load("appliance.xrc");
>
> my $newFrame = $xrc->LoadFrame(undef,'ID_FRAME') ;
>
> my $tree = $newFrame->FindWindow('ID_TREECTRL_MENU') ;
> my $var = "Test Var" ;
>
> $newFrame->{var} = $var ;
> return $newFrame,;
> }
>
>
>
>
> --------------------------------------------------------------
> -----------
> Using Tomcat but need to do more? Need to support web
> services, security?
> Get stuff done quickly with pre-integrated technology to make
> your job easier Download IBM WebSphere Application Server
> v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&
> dat=121642
> _______________________________________________
> wxperl-users mailing list
> wxp...@li...
> https://lists.sourceforge.net/lists/listinfo/wxperl-users
|