Oh, sorry, bugfix,
line 83 add:
 $scrollarea->Left(0 - $scrollwindow->ScrollPos(0));
Helps if you keep tracking the scrollbar during resize :)
This stops weird behaviour if you scroll then resize the window.
----- Original Message -----
From: Jez White
To: Stephen Pick ; Win32-GUI
Sent: Friday, January 16, 2004 1:34 PM
Subject: Re: [perl-win32-gui-users] Scroll bar example

Thanks for all the replies/suggestions.
I have to admit I'm more confused now than I was when I started:)
I tried your suggestions Steve, I end up with something that works like an MDI application - which is nice in itself, but not what I was after:) 
Basically is it possible to use a scroll bar within a window, and not on one of it's edges? I'm trying to think of a clearer example than my tab strip one. Imagine a image viewing program with the main window filled with controls, the image could be larger than the screen so you want to place scroll bars on the image and not on the window (almost like putting a scroll bar on a control). I had assumed you could use somesort of child window to achieve this kind of effect?
My thought process was basically inline with what Johan was suggesting - if a child window could be just another control, then the parent window would not lose focus and everything would be hunky dory. Using a child window in this manor would also make sense when attaching a child window to a band in the rebar control.
Or am I just way off the mark here?:)
----- Original Message -----
From: Stephen Pick
To: Jez White ; Win32-GUI
Sent: Friday, January 16, 2004 12:58 PM
Subject: RE: [perl-win32-gui-users] Scroll bar example

Your code is bad. What you're doing is creating a floating "BorderlessWindow" positioned over the top of the main window. If you want to put your window *INSIDE* the client area I suggest you do this:
use Win32::API;
our $SETPARENT = new Win32::API("user32","SetParent","NN","N") or croak "Failed to load SetParent from user32.dll";
my $child = new Win32::GUI::DialogBox(
    -parent => $win,
    -name => "Child",
    -left => 0,
    -top => 0,
    -text => "Child",
    -width => 100,
    -height => 100,
    -style => WS_CHILD,
$SETPARENT->Call($child->{-handle}, $win->{-handle});
$child->Width($child->Width); # force update.
After doing this stuff, you'll find you have a dialogbox inside the main window. It also clips if you drag it "out" of the main window, so it truely is inside. You can even give it a WS_CAPTION and drag it around in the client area.
Giving things a -parent argument does NOT mean SetParent is called on them in Win32::GUI.
-----Original Message-----
From: perl-win32-gui-users-admin@lists.sourceforge.net [mailto:perl-win32-gui-users-admin@lists.sourceforge.net]On Behalf Of Jez White
Sent: 16 January 2004 12:37
To: Win32-GUI
Subject: [perl-win32-gui-users] Scroll bar example

The example below will only work on the latest code line from CVS.
I'm trying to get my head round using scroll bars. In my test example I want to create a window containing one tab strip. In the tab strip there will be a child window containing a scroll bar and 10 buttons. Scrolling the scroll bar will move the buttons into and out view.
Now, the scrolling part works fine - but is using a child window in this way the correct approach? For example, interacting with the child window (clicking on a button, or scrolling) loses focus (which you would expect for a normal window) but is not the correct behaviour in this case. Am I missing something fundamental?
Apologies for the dodgy code - is a hack job:)
use Win32::GUI;
use Win32::GUI::BorderlessWindow;
#create the main window
my $win = new Win32::GUI::Window (
 -name => "MainWin",
 -left => 0,
 -top => 100,
 -width => 500,
 -height => 300,
 -sizable => 1,
 -text => "Scrollbar Test 2",
 -noflicker => 1,
#create a tab strip
$win->AddTabStrip (
 -name => "Tab",
 -left => 0,
 -top => 100,
 -width => 250,
 -height => 150, 
$win->Tab->InsertItem(-text => 'Some Tab');
#create a child window with a scroll bar
my $childwin = new Win32::GUI::BorderlessWindow (
 -name => "Child",
 -parent =>$win,
 -left => 10,
 -top => 250,
 -width => 200,
 -height => 120,
 -hscroll => 1,
 -noflicker => 1,
 -onScroll => \&scrolled
#create content for our child window, 10 buttons.
foreach (0..9) {
  $childwin->AddButton (
           -name     => "Button".$_,
           -pos      => [$_*50, 30],
           -size     => [50, 20],
           -text     => 'Button'.$_,);
#set the scrollbar range and starting pos
sub scrolled {
 my($object,$bar,$operation,$pos) = @_;
 my $string;
 #Scroll the buttons...
 if($operation == SB_THUMBTRACK) {
    foreach (0..9) {