in reply to Re^3: Win32 GUI scrolling controls within the main window
in thread Win32 GUI scrolling controls within the main window

I have managed to create a solution which lets Win32::GUI::Grid do the work for me

That gets me an area of the screen that holds my Labels (in practice these are a 4 wide x X deep grid of pictures for my app) The labels are contained by the grid and no longer go over the status bar and the Grid control makes the scroll bars around itself appear and disappear as needed.

In its simplest form here is some code.

I would recommend using $Grid->AutoSize() just before $main->Show(); for a real grid to do the sizing but for this eaxmple I wanted 80 x 80 cells to make the scrollbar appear

If you resize the window then the scrollbr should come and go

use Win32::GUI; use Win32::GUI::Grid; use warnings; use strict; my $main = Win32::GUI::Window->new( -name => "Main", -title => "Test", -pos => [100, 100], -size => [200, 200], ) or die "new Window"; my $Grid = $main->AddGrid ( -name => "Grid", -pos => [20, 20], ) or die "new Grid"; $Grid->SetColumns(1); $Grid->SetRows(2); $Grid->SetRowHeight(0, 80); $Grid->SetRowHeight(1, 80); $Grid->SetColumnWidth(0, 80); $Grid->SetCellText(0, 0, 'Cell 1'); $Grid->SetCellText(1, 0, 'Cell 2'); my $sb = $main->AddStatusBar(); $main->Show(); Win32::GUI::Dialog(); sub Window_Terminate { return -1; } sub Main_Resize { $sb->Move(0, $main->ScaleHeight - $sb->Height); $sb->Resize($main->ScaleWidth, $sb->Height); my ($width, $height) = ($main->GetClientRect)[2..3]; $Grid->Resize (110, $height - $sb->Height - 20); }
  • Comment on Re^4: Possible solution to Win32 GUI scrolling controls within the main window
  • Download Code