NAME

Gapp::Meta::Widget::Native::Trait::Form - Form trait for widgets

DESCRIPTION

Apply this traits to widgets that you want to use as forms.

SYNOPSIS

use Gapp::Actions::Form qw( Ok );

Gapp::Window->new(

    traits => [qw( Form )],

    content => [

        Gapp::HBox->new(

            Gapp::Entry->new( field => 'user.name' ),

            Gapp::Button->new( action => Ok ),

        )

    ],

);

PROVIDED ATTRIBUTES

context
is rw
isa Gapp::Form::Context|Undef

The context is used to sync data between your objects or data structures and the form fields.

stash
is rw
isa Gapp::Form::Stash|Undef

The stash is used to store the values of the form fields. Calling apply or ok on the form will update the values in the stash. Calling update on the form will update your field values with those in the stash.

sync
is rw
isa Bool
default 1

If set to true and the form has a context, the objects in the context will be updated as the user updates the form. If you make changes to the objects, you will need to call update_from_context to see your changes reflected in the form.

PROVIDED METHODS

apply

Updates the stash and context with values from the form.

close

Destroys the form.

cancel

Calls close

ok

Calls apply then close.

find_fields

Returns a list of all the fields within the form.

update

Update the fields widgets with the values contained in the stash.

update_stash

Update the stash with values in the field widgets.

update_from_context

Updates the stash using the context, then calls update.

update_stash

Updates the stash using values in the form fields.

AUTHORS

Jeffrey Ray Hallock <jeffrey.hallock at gmail dot com>

COPYRIGHT & LICENSE

Copyright (c) 2011-2012 Jeffrey Ray Hallock.

This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.