Hi,

I can confirm that scrollbars work, and work well.

Your almost there - it took me a while to understand how it all works:)

In windows, scroll bars are really nothing more than dressing and you are
responsible for updating and changing the client area as scrolling takes
place. There are a couple of approaches that can be taken depending on what
needs to be done. In your case, you would have to move all the items up or
down, depending on the scroll bar positions. An alternative approach would
be to create a child window of the child window. This child would contains
all the controls. You then simply move the window up and down as the scroll
bars are moved.

Hopefully this made some sense!

Cheers,

jez.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, June 16, 2004 9:20 PM
Subject: [perl-win32-gui-users] Window / Dialogbox scrollbars


> 
> 
> 
> 
> 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 ; }
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> _______________________________________________
> Perl-Win32-GUI-Users mailing list
> Perl-Win32-GUI-Users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users

Reply via email to