Hi, Has anyone managed to get wxSashWindows to work? I managed to find a version written in wxRuby on google, but it was full of SashLayoutWindows commands, which don't appear in wxPerl.
I played around with it for a while (scroll down for a working version).
The alternative, if I want to have multiple windows, seems to be multiple
WindowSplitters?
What do you think? Do you use SashWindows or WindowSplitter?
Regards
Steve
PS Here is some sample code.
#!/usr/bin/perl -w --
use Wx 0.15 qw[:allclasses];
use strict;
package MyFrame;
use Wx qw[:everything];
use base qw(Wx::Frame);
use strict;
sub new {
my( $self, $parent, $id, $title, $pos, $size, $style, $name ) = @_;
$parent = undef unless defined $parent;
$id = -1 unless defined $id;
$title = "" unless defined $title;
$pos = wxDefaultPosition unless defined $pos;
$size = wxDefaultSize unless defined $size;
$name = "" unless defined $name;
$style = wxDEFAULT_FRAME_STYLE
unless defined $style;
$self = $self->SUPER::new( $parent, $id, $title, $pos,
Wx::Size->new(1300,768), $style, $name );
# Create some layout windows
# A red window at the top like a toolbar
$self->{topwin} = Wx::SashWindow->new($self, -1, [0,0], Wx::Size->new(1000,
30), wxNO_BORDER );
$self->{topwin}->SetBackgroundColour(Wx::Colour->new(255, 0, 0));
# $self->{topwin}->SetSashVisible(wxSASH_BOTTOM, 1);
# A blue window at the bottom like a statusbar
$self->{bottomwin} = Wx::SashWindow->new($self, -1, [0,630],
Wx::Size->new(1000, 30),wxNO_BORDER);
$self->{bottomwin}->SetBackgroundColour(Wx::Colour->new(0, 0, 255));
# $self->{bottomwin}->SetSashVisible(wxSASH_TOP, 1);
# A green window to the left of the client window
$self->{leftwin1} = Wx::SashWindow->new($self, -1, [0,30],
Wx::Size->new(120, 300),wxNO_BORDER);
$self->{leftwin1}->SetBackgroundColour(Wx::Colour->new(0, 255, 0));
# $self->{leftwin1}->SetSashVisible(wxSASH_RIGHT, 1);
$self->{text_window} = Wx::TextCtrl->new($self->{leftwin1}, -1, "",
wxDefaultPosition,wxDefaultSize,wxSUNKEN_BORDER);
$self->{text_window}->SetValue("A sub window");
# Another window to the left (turquoise) of the client window
$self->{leftwin2} = Wx::SashWindow->new($self, -1, [0,330],
Wx::Size->new(120, 300),wxNO_BORDER);
$self->{leftwin2}->SetBackgroundColour(Wx::Colour->new(0, 255, 255));
# $self->{leftwin2}->SetSashVisible(wxSASH_RIGHT, 1);
# White will occupy the space not used by the Layout Algorithm
$self->{remaining_space} = Wx::Panel->new($self, -1, [120,30],
Wx::Size->new(880, 600), wxSUNKEN_BORDER);
$self->{remaining_space}->SetBackgroundColour(Wx::Colour->new(255, 255,
255));
# end wxGlade
return $self;
}
1;
package main;
unless(caller){
local *Wx::App::OnInit = sub{1};
my $app = Wx::App->new();
Wx::InitAllImageHandlers();
my $frame_1 = MyFrame->new();
$app->SetTopWindow($frame_1);
$frame_1->Show(1);
$app->MainLoop();
}
<<Blank Bkgrd.gif>>
