LibUI::Group - Control Container that Adds a Label to the Contained Child Control
use LibUI ':all'; use LibUI::Group; use LibUI::HBox; use LibUI::Window; use LibUI::ColorButton; use LibUI::Label; Init( { Size => 1024 } ) && die; my $window = LibUI::Window->new( 'Hi', 320, 100, 0 ); my $group = LibUI::Group->new('Color Pickers'); my $box = LibUI::HBox->new; my $cbtn_l = LibUI::ColorButton->new(); my $cbtn_r = LibUI::ColorButton->new(); sub colorChanged { warn sprintf '#%02X%02X%02X%02X', map { $_ * 255 } shift->color(); } $cbtn_l->onChanged( \&colorChanged, $cbtn_l ); $cbtn_r->onChanged( \&colorChanged, $cbtn_r ); $box->append( $_, 1 ) for $cbtn_l, $cbtn_r; $group->setChild($box); $window->setChild($group); $window->onClosing( sub { Quit(); return 1; }, undef ); $window->show; Main();
A LibUI::Group object represents a control container that adds a label to the contained child control.
This control is a great way of grouping related controls in combination with LibUI::HBox and LibUI::VBox.
A visual box will or will not be drawn around the child control dependent on the underlying OS implementation.
Not a lot here but... well, it's just a tab box.
new( ... )
my $grp = LibUI::Group->new( 'Login' );
Creates a new LibUI::Group.
margined( )
if( $grp->margined( ) ) { ...; }
Returns whether or not the group has a margin.
setMargined( ... )
$grp->setMargined( 1 );
Sets whether or not the group has a margin.
The margin size is determined by the OS defaults.
Expected parameters include:
$margin
setChild( ... )
$grp->append( $box );
Sets the group's child.
$child
delete( ... )
$grp->delete( $index );
Removes the control at $index.
$index
Note: The control is neither destroyed nor freed.
title( )
my $text = $grp->title( );
Returns the group title.
setTitle( ... )
$grp->setTitle( $text . '*' );
Sets the group title.
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Sanko Robinson <sanko@cpan.org>
To install LibUI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LibUI
CPAN shell
perl -MCPAN -e shell install LibUI
For more information on module installation, please visit the detailed CPAN module installation guide.