Bonjour à tous,

Voilà, je n'arrive pas à créer de boxsizer dans dans une fenêtre qui contient deux fenêtres (à l'aide de Wx::SplitWindow)

Voilà mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
 
 
use Wx;
use splitwin;
use MyCanvas;
use Wx qw (wxDefaultPosition wxDefaultSize wxLEFT wxRIGHT wxHORIZONTAL wxVERTICAL wxALL wxALIGN_TOP wxALIGN_CENTER wxALIGN_BOTTOM wxALIGN_LEFT wxALIGN_RIGHT wxEXPAND wxOK wxCANCEL wxID_OK);
use vars qw (@ISA);
@ISA=qw(Wx::Frame);
use Wx qw( :color );
sub new
{
      my($classe)=shift;
      my $this=$classe->SUPER::new(@_);
my( $splitter ) = $this->{SPLITTER} = SplitWindow->new( $this, -1 );      
my ($LCanvas)=$this->{LCANVAS}=MyCanvas->new($splitter,-1,[0,0],[200,250],'Menu');
my ($RCanvas)=$this->{RCANVAS}=MyCanvas->new($splitter,-1,[200,0],[400,250],'Corps');
 
$this->{LCANVAS}->Show( 1 );
$this->{RCANVAS}->Show( 1 );
 
$LCanvas->SetBackgroundColour( Wx::Colour->new(255,255,255) );
$LCanvas->SetCursor( Wx::Cursor->new( wxCURSOR_HAND  ) );
 
 
#Définition des widgets
 
$LCanvas->{'Bouton2'}=Wx::Button->new($LCanvas,-1,"Search");
$LCanvas->{'Text'}=Wx::TextCtrl->new($LCanvas,-1,"");
 
#Définition des box sizers
       $LCanvas->{'BoxSizer1'}=Wx::BoxSizer->new(wxVERTICAL);
       $LCanvas->{'BoxSizer11'}=Wx::BoxSizer->new(wxHORIZONTAL);
       $LCanvas->{'BoxSizer12'}=Wx::BoxSizer->new(wxHORIZONTAL);
 
#Ajout des widgets dans le box size 11 (haut)      
      $LCanvas->{'BoxSizer11'}->Add($LCanvas->{'Text'},1,wxLEFT,0);
#Ajout des widgets dans le box size 12 (bas)      
      $LCanvas->{'BoxSizer12'}->Add($LCanvas->{'Bouton2'},1,wxLEFT,0);
 
#Ajout des deux box sizer dans le box sizer principal
 
      $LCanvas->{'BoxSizer1'}->Add($LCanvas->{'BoxSizer11'},1,wxALL,3);
      $LCanvas->{'BoxSizer1'}->Add($LCanvas->{'BoxSizer12'},1,wxALL,3);
 
      $LCanvas->SetSizer($LCanvas->{'BoxSizer1'});
Et voici les packages SplitWindow
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 
package SplitWindow;
 
use strict;
use vars qw(@ISA);
@ISA = qw(Wx::SplitterWindow);
use Wx qw(:splitterwindow wxDefaultPosition wxDefaultSize);
use Wx::Event qw(EVT_SPLITTER_SASH_POS_CHANGED);
 
sub new()
{
      my $class=shift;
      my( $this ) = $class->SUPER::new( @_, wxDefaultPosition, wxDefaultSize,
                                    wxSP_3D|wxSP_LIVE_UPDATE|wxSP_BORDER| wxSP_3DBORDER  );
      return $this;
}
 
1;
et MyCanvas

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
 
package MyCanvas;
 
use strict;
use vars qw(@ISA);
 
@ISA = qw(Wx::ScrolledWindow);
sub new {
  my( $class ) = shift;
  my( $this ) = $class->SUPER::new( @_[0,1,2,3], 0, $_[4] );
  return $this;
}
1;

Pourquoi je n'arrive pas à placer mon bouton et mon textbox comme il faut.
Il se superpose, comme ci il n'existait pas de sizer ???

Pleaseee, Help me ???

Merci beaucoup pour les réponses