From: Peter G. <pe...@pg...> - 2006-10-17 12:29:51
|
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,; } |