Using two xrc files

[email protected] (RAPPAZ Francois)
Newsgroups perl.wxperl.users
Message-ID <[email protected]>
I would like to split my gui in two xrc files. One file (test.xrc) has buttons to navigate database rows and the other (content2.xrc) displays a row and has fields and labels.

Content2.xrc has a top frame wxFrame, a vertical sizer, and a wxPanel (m_panel1). This panel hold the fields and labels.

test.xrc has a top frame, a menubar and boxsizer that holds two panels (m_panel1 and m_panel2). 

I would like to replace test.xrc's m_panel1 with content2.xrc's m_panel1. 

I have the following code that print ok (after the gui is displayed) but that does not show the fields and labels from content2.xrc

Thanks for any help

François 

sub new {
    my( $class, $parent ) = @_;
    my $self = $class->SUPER::new( $parent );
    # load XRC file
    $self->{xrc} = Wx::XmlResource->new();
    $self->xrc->InitAllHandlers();
      $self->xrc->Load('xrc/test.xrc');
    $self->{app} = Wx::SimpleApp->new;
    $self->show_frame();
    return $self;
}

sub show_frame {
    my( $self ) = @_;
    # my $frame = Wx::Frame->new( undef, -1, 'XML resources demo', [50, 50], [450, 340] );
    my $frame = $self->{xrc}->LoadFrame(undef, 'MyFrame1');
     my $panel = Wx::Window::FindWindowByLabel('m_panel1', $frame);
	$self->reparent('xrc/content2.xrc', $panel);
       $frame->Show;
}

 sub reparent {
	 my ($self, $path, $where) = @_;
         my $xrc =  Wx::XmlResource->new;
	$xrc->InitAllHandlers();
	#Load('xrc/content2.xrc');
	$xrc->Load($path);
	my $subframe = $xrc->LoadFrame(undef,'MyFrame1');
        $subframe->Show;
	my $content = Wx::Window::FindWindowByLabel('m_panel1', $subframe);
       if ($content->Reparent($where)) { print "OK";} else {print "failed";}
       $subframe->Destroy;
 
 }     



François Rappaz

Centre de documentation de la Faculté des Sciences Université de Fribourg DokPe - Dokumentationszentrum der Naturwissenschaftlichen Fakultät Universität Freiburg 
Rue du Musée 4
CH-1700 Fribourg Switzerland http://www.unifr.ch/dokpe/
Tel.: 41 (0)26 300 92 60
Fax.: 41 (0)26 300 97 30
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.