Forgot the example - I need a coffee:)
==============
use Win32::GUI;
use strict;
#create a dummy menu
my $Menu = new Win32::GUI::Menu(
"&File" => "File",
" > &New",
" > &Open",
" > &Save",
" > Save &As",
" > &Close",
);
#create the main window
my $mainwindow = new GUI::Window(
-title => "Win32::GUI::Rebar test",
-left => 100,
-top => 100,
-width => 600,
-height => 200,
-name => "Window",
-menu => $Menu,
-onTerminate => sub { return -1 },
);
#create a child window for band 2 of the rebar control, this band will contain
two dropdowns
my $band2 = new Win32::GUI::Window (
-parent => $mainwindow,
-name => "RebarBand2",
-popstyle => WS_CAPTION | WS_SIZEBOX,
-pushstyle => WS_CHILD,
);
#create the first drop down
my $dd1 = $band2->AddCombobox(
-name => "Dropdown",
-pos => [0, 0],
-size => [100, 80],
-addstyle => 3 | 2097152 | 1048576,
-tip => 'Some items',
);
$dd1->Add('Item 1','Item 2','Item 3','Item4');
$dd1->Select(0);
#create the second drop down
my $dd2 = $band2->AddCombobox(
-name => "Dropdown2",
-pos => [105, 0],
-size => [100, 80],
-addstyle => 3 | 2097152 | 1048576,
-tip => 'Some colours',
);
$dd2->Add('Red','Blue','Green');
$dd2->Select(0);
#create a child window for band 3 of the rebar control
my $band3 = new Win32::GUI::Window (
-parent => $mainwindow,
-name => "RebarBand3",
-popstyle => WS_CAPTION | WS_SIZEBOX,
-pushstyle => WS_CHILD,
);
# create Date time control for band 3
my $DateTime = $band3->AddDateTime (
-name => "DateTime",
-pos => [0, 0],
-size => [130, 20],
-tip => 'A date and time',
);
#set the format for the datetime control
$DateTime->Format('dd-MMM-yyyy HH:mm:ss');
#Add a button to band 3
$band3->AddButton (
-name => 'Button',
-pos => [135, 0],
-size => [50, 20],
-text => 'Button',
-tip => 'A Button',
-onClick => sub {print 'button clicked' },
);
#Add a button to band 3
$band3->AddButton (
-name => 'Button1',
-pos => [195, 0],
-size => [50, 20],
-text => 'Button1',
-tip => 'A Button',
-onClick => sub {print 'button1 clicked' },
);
#create a rebar control
my $rebar = $mainwindow->AddRebar(
-name => "Rebar",
-bandborders => 1,
);
#Insert band 1
$rebar->InsertBand (-text => 'One' ,);
#Insert band 2
$rebar->InsertBand (
-child => $band2,
-width => 210,
-minwidth => 210,
-minheight => 20,
);
#Insert band 3
$rebar->InsertBand (
-child => $band3,
-width => 250,
-minwidth => 250,
-minheight => 20,
);
#show the main window
$mainwindow->Show;
Win32::GUI::Dialog;
sub Rebar_HeightChange {
#event not working?
print 'Rebar_HeightChange';
}