The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Fl::Group - The FLTK Container Widget

Synopsis

    my $group = Fl::Group->new(100, 200, 340, 180);
    $group->begin();
    # Create new widgets here
    $group->end();

Description

Fl::Group is the FLTK container widget.

It maintains an array of child widgets. These children can themselves be any widget including Fl::Group. The most important subclass of Fl::Group is Fl::Window, however groups can also be used to control radio buttons or to enforce resize behavior.

The tab and arrow keys are used to move the focus between widgets of this group, and to other groups. The only modifier grabbed is shift (for shift-tab), so that ctrl-tab, alt-up, and such are free for the app to use as shortcuts.

Methods

Fl::Group is a subclass of Fl::Widget but also supports these methods:

new(...)

The constructor creates a group of a given size and position on screen or within the parent.

    my $group_a = Fl::Group->new(100, 150, 300, 500);

...or...

    my $group_b = Fl::Group->new(100, 150, 300, 500, 'Math is singular');

In these examples, the new group is placed 100 pixels from the left and 150 pixels down from the top of either the display area or parent widget.

The destructor also deletes all children. This allows a whole tree to be deleted at once, without having to keep a pointer to all children in the user code.

add(...)

    my $button = Fl::Button->new(...);
    $group->add($button);

Adds a widget to the end of this group. If the widget already has a parent, it is first removed from that parent.

add_resizable(...)

    my $button = Fl::Button->new(...);
    $group->add_resizable($button);

Adds the widget to the group and makes it the resizable widget.

begin()

Sets the current group so youcan build the widget tree by just constructing the widgets.

    $group_a->begin();
    Fl::Box->new(100, 75); # Automatically added to $group_a

begin() is automatically called by the constructor for Fl::Group (and thus Fl::Window as well). <begin()> is exactly the same as Fl::current(...). Don't gorget to end() the group or window!

children()

Returns how many child widgets the group has.

clear()

Deletes all child widgets from memory recursively.

This method differs from the remove() method in that it affects all child widgets and deletes them from memory.

end()

Any new widgets added to the widget tree will be added to the parent of the group.

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>