NAME
Tk::Role::Dialog - moose role for enhanced tk dialogs
VERSION
version 1.101381
SYNOPSIS
package Your::Tk::Dialog::Class;
use Moose;
with 'Tk::Role::Dialog';
sub _build_title { 'window title' }
sub _build_icon { '/path/to/some/icon.png' }
sub _build_header { 'big dialog header' }
sub _build_resizable { 0 }
sub _build_ok { 'frobnize' } # call $self->_valid
sub _build_cancel { 'close' } # close the window
sub _build_gui {
# build the inner dialog widgets
}
sub _valid {
# called when user clicked the 'ok' button
$self->close;
}
# in your main program
use Your::Tk::Dialog::Class;
# create & show a new dialog
Your::Tk::Dialog::Class->new( parent => $main_window );
DESCRIPTION
Tk::Role::Dialog is meant to be used as a Moose role to be composed for easy Tk dialogs creation.
It will create a new toplevel with a title, and possibly a header as well as some buttons.
The attributes (see below) can be either defined as defaults using the _build_attr()
methods, or passed arguments to the constructor call. The only mandatory attribute is parent
, but you'd better provide some other attributes if you want your dialog to be somehow usable! :-)
ATTRIBUTES
parent
The parent window of the dialog, required.
icon
The path to an image to be used as dialog icon. No default, but not required.
title
The dialog title, default to tk dialog
header
A header (string) to display at the top of the window. Default to empty string, meaning no header.
resizable
A boolean to control whether the dialog can be resized or not (default).
ok
A string to display as validation button label. Default to empty string, meaning no validation button. The validation action will call $self->_valid()
.
cancel
A string to display as cancellation button label. Default to empty string, meaning no cancellation button. The cancel action is to just close the dialog.
METHODS
close
$dialog->close;
Request to destroy the dialog.
SEE ALSO
You can look for information on this module at:
Search CPAN
See open / report bugs
Git repository
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
AUTHOR
Jerome Quelin
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Jerome Quelin.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.