Laslo Forro <getfo...@gmail.com> writes: > my $app=myApp->new($obj)
So you pass an object arg to your derived class. > sub new { > my ($ref,$obj)=...@_; This is the constructor os your derived class. > my $self=$ref->SUPER::new($obj); Here you pass the object to the super class constructor. However, Wx::App does not take an object as its argument. So it complains: > sub must be a CODE reference at .../Wx/App.pm line 36. > I would like to use this object from the frame I have created. Eg. I would > like to access the object from an event sub, like > sub OnClick { > my ($self,$even)=...@_; > $self->{myObject}->do_this()… > } > For this, in the subclass constructor, use something similar to: sub new { my ( $ref, $obj ) = @_; my $self = $ref->SUPER::new; ... my $frame = MyFrame->new; $frame->{Object} = $obj; ... $self->SetTopWindow($frame); $frame->Show; ... } -- Johan