NAME
LibUI::Form - Control Container to Organize Ccontained Controls as Labeled Fields
SYNOPSIS
use LibUI ':all';
use LibUI::Form;
use LibUI::Window;
use LibUI::ColorButton;
Init && die;
my $window = LibUI::Window->new( 'Hi', 320, 100, 0 );
$window->setMargined( 1 );
my $form = LibUI::Form->new();
my $cbtn_l = LibUI::ColorButton->new();
my $cbtn_r = LibUI::ColorButton->new();
sub colorChanged {
warn sprintf '%5s #%02X%02X%02X%02X', pop, map { $_ * 255 } shift->color();
}
$cbtn_l->onChanged( \&colorChanged, 'Left' );
$cbtn_r->onChanged( \&colorChanged, 'Right' );
$form->append( 'Left', $cbtn_l, 0 );
$form->append( 'Right', $cbtn_r, 0 );
$form->setPadded(1);
$window->setChild($form);
$window->onClosing(
sub {
Quit();
return 1;
},
undef
);
$window->show;
Main();
DESCRIPTION
A LibUI::Form object represents a container control to organize contained controls as labeled fields.
As the name suggests this container is perfect to create ascetically pleasing input forms.
Each control is preceded by it's corresponding label.
Labels and containers are organized into two panes, making both labels and containers align with each other.
Functions
Not a lot here but... well, it's just a tab box.
new( ... )
my $frm = LibUI::Form->new( );
Creates a new form.
append( ... )
$frm->append( 'Color', $kid, 0 );
Appends a control with a label to the form.
Expected parameters include:
$text
- label text$child
- LibUI::Control instance to append$stretchy
- true to stretch control, otherwise false
Stretchy items expand to use the remaining space within the container. In the case of multiple stretchy items the space is shared equally.
delete( ... )
$frm->delete( 1 );
Removes the control at $index
from the form.
Note: The control is neither destroyed nor freed.
numChildren( )
my $tally = $frm->numChildren( );
Returns the number of controls contained within the form.
padded( )
if( $frm->padded ) {
...;
}
Returns whether or not controls within the form are padded.
Padding is defined as space between individual controls.
setPadded( ... )
$box->setPadded( 1 );
Sets whether or not controls within the box are padded.
Padding is defined as space between individual controls. The padding size is determined by the OS defaults.
LICENSE
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Sanko Robinson <sanko@cpan.org>