In the latest WIN32::GUI ver0.0.671 it indicates that the scrollbars have
been implemented for
Windows and Dialogbox's. I cannot seem to figure out how to get the
client area of the window
to scroll. I have some example code below. Could someone please explain
to me how I can
get this to work. My pea-brain just doesn't seem to grasp what I need to
do.
Thanks in advance for any guidance........................
use Win32::GUI;
use strict;
my $operation;
my $position;
our $mainwin = new Win32::GUI::Window(
-name => "Main",
-text => "Main",
-top => 20,
-left => 20,
-width => 250,
-height => 250,
-minheight => 235,
-minwidth => 215, );
our $child = new Win32::GUI::Window (
-name => "Child",
-parent => $mainwin,
-height => 200,
-width => 200,
-top => 5,
-left => 5,
-popstyle => WS_CAPTION | WS_SIZEBOX,
-pushstyle => WS_CHILD,
-pushexstyle => WS_EX_CLIENTEDGE,
-vscroll => 1, );
$child->AddLabel( -name =>"OPER",
-top =>8,
-left =>25,
-text =>"OPER = ",);
$child->AddLabel( -name =>"POS",
-top =>8,
-left =>100,
-text =>"POS = ",);
$child->AddLabel( -name =>"SB_OPER",
-top =>8,
-left =>75,
-text =>" $operation ",);
$child->AddLabel( -name =>"SB_POS",
-top =>8,
-left =>140,
-text =>" $position ",);
for my $x ( 1..10 ) {
my $top = ($x*25) ;
$child->AddCheckbox(-name =>"test $x",
-top =>$top,
-left =>25,
-height =>22,
-tabstop =>1,
-text =>"test $x",);
}
$mainwin->Show();
$child->Show();
Win32::GUI::Dialog;
sub Child_Scroll() {
my ($scrollbar, $operation, $position) = @_;
if($operation == 0 ) { # SB_LINEUP
$child->ScrollPos($scrollbar,$child->ScrollPos($scrollbar) - 1 );
}
elsif($operation == 1 ) { # SB_LINEDOWN
$child->ScrollPos($scrollbar,$child->ScrollPos($scrollbar) + 1 );
}
elsif($operation == 2 ) { # SB_PAGEUP
$child->ScrollPos($scrollbar,$child->ScrollPos($scrollbar) - 3 );
}
elsif($operation == 3 ) { # SB_PAGEDOWN
$child->ScrollPos($scrollbar,$child->ScrollPos($scrollbar) + 3 );
}
elsif($operation == 5 ) { # SB_THUMBTRACK
$child->ScrollPos($scrollbar,$position);
}
my ($width, $height) = ($child->GetClientRect)[2..3];
if ( $operation != 8 ) {
$child->SB_OPER->Text($operation);
$child->SB_POS->Text($position);
# print "SCROLLBAR = $scrollbar | OPERATION = $operation | POSITION =
$position \n";
}
}
sub Main_Terminate { -1 ; }