GridLayout(3) User Contributed Perl Documentation GridLayout(3)NAME
Win32::GUI::GridLayout - Grid layout support for Win32::GUI
SYNOPSIS
use Win32::GUI::
use Win32::GUI::GridLayout;
# 1. make a "static" grid
$grid = new Win32::GUI::GridLayout(400, 300, 3, 3, 0, 0);
$win = new Win32::GUI::Window(
$win->AddLabel(
-name => "label1",
-text => "Label 1",
-width => $grid->width(35),
-height => $grid->height(11),
-left => $grid->col(1, "left"),
-top => $grid->row(1, "top"),
);
# 2. make a "dynamic" grid
$grid = apply Win32::GUI::GridLayout($win, 3, 3, 0, 0);
or
$grid = apply Win32::GUI::GridLayout($win,
[qw(10 * * 10)],
[qw(10 * 40)],
0, 0);
$win->AddLabel(
-name => "label1",
-text => "Label 1",
);
$grid->add($win->label1, 1, 1, "left top");
or
$grid->add($win->label1, [2..3], 1, "justify justify");
$grid->recalc();
DESCRIPTION
Constructors
new Win32::GUI::GridLayout(COLS, ROWS, WIDTH, HEIGHT, XPAD, YPAD)
apply Win32::GUI::GridLayout(WINDOW, COLS, ROWS, XPAD, YPAD)
COLS - quantity of columns or arrayref of width colomns (number -
absolute width, * - relative width)
ROWS - quantity of rows or arrayref of height rows (number -
absolute height, * - relative height)
Methods
add(CONTROL, COL, ROW, ALIGN)
Adds CONTROL to the grid at (COL, ROW). ALIGN can specify both
horizontal and vertical alignment (see the col() and row()
methods), separated by at least one blank and/or a comma.
Example:
$grid->add($win->label1, 1, 1, "left top");
or
$grid->add($win->label1, [2..3], 1, "justify top");
COL and ROW may be arrayref for adds CONTROL into more than one
cell. If ALIGN is justify (j) than CONTROL expands up to cell.
col(N, ALIGN)
Positions the control at the Nth column in the grid, optionally
with an ALIGN; this can be feed to a "-left" option when creating a
control.
ALIGN can be "left", "center" or "right" (can be shortened to "l",
"c", "r"); default is "left".
Note that for alignment to work properly, the width() and height()
methods must have been previously called.
Example:
$win->AddLabel(
-name => "label1",
-text => "Label 1",
-width => $grid->width(35),
-height => $grid->height(11),
-left => $grid->col(1, "left"),
-top => $grid->row(1, "top"),
);
draw()
Draws the GridLayout in the associated window (may be useful for
debugging); is only meaningful if the GridLayout was created with
the apply() constructor.
height(N)
Sets the height of the control for subsequent alignment; this can
be feed to a "-height" option when creating a control.
Example: see col().
recalc()
Recalculates the grid and repositions all the add()ed controls,
taking into account the actual window and controls sizes; is only
meaningful if the GridLayout was created with the apply()
constructor.
Example:
sub Window_Resize {
$grid->recalc();
}
row(N, ALIGN)
Positions the control at the Nth row in the grid, optionally with
an ALIGN; this can be feed to a "-top" option when creating a
control.
ALIGN can be "top", "center" or "bottom" (can be shortened to t, c,
b); default is top.
Note that for alignment to work properly, the width() and height()
methods must have been previously called.
Example: see col().
width(N)
Sets the width of the control for subsequent alignment; this can be
feed to a "-width" option when creating a control.
Example: see col().
VERSION
Win32::GUI::GridLayout version 0.06, June 2006.
Win32::GUI::GridLayout version 0.05, 24 June 2005.
Win32::GUI::GridLayout version 0.04, 06 April 2005.
Win32::GUI::GridLayout version 0.03, 13 April 1999.
AUTHOR
Original Author Mike Kangas ( "kangas@anlon.com" ); additional coding
by Aldo Calpini ( "dada@perl.it" ), Alexander Romanenko (
"alex@parom.biz" ), Robert May ( "robertemay@users.sourceforge.net" ).
COPYRIGHT AND LICENCE
Copyright (C) 1999..2005 by Mike Kangas Copyright (C) 2006 by Robert
May
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
perl v5.14.2 2006-10-15 GridLayout(3)