GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Tk::Role::Dialog(3) User Contributed Perl Documentation Tk::Role::Dialog(3)

Tk::Role::Dialog - moose role for enhanced tk dialogs

version 1.112380

    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 {
        my ($self, $frame) = @_;
        # build the inner dialog widgets in the $frame
    }
    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 );

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.

One can create the middle part of the dialog by providing a "_build_gui()" method, that will receive a Tk::Frame where widgets are supposed to be placed.

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! :-)

The parent window of the dialog, required.

Whether the dialog should popup or stay hidden after creation. Default to false, which means the dialog is shown.

The path to an image to be used as window icon. Default to empty string (meaning no customized window icon), but not required.

The dialog title, default to "tk dialog".
A header (string) to display at the top of the window. Default to empty string, meaning no header.

The path to an image to be displayed alongside the dialog text. Not taken into account if "text" attribute is empty. Default to empty string, meaning no image.

Some text to be displayed, for simple information dialog boxes. Default to empty string, meaning dialog is to be filled by providing a "_build_gui()" method. Can be combined with an "image" attribute for enhanced appearance.

A boolean to control whether the dialog can be resized or not (default).

A string to display as validation button label. Default to empty string, meaning no validation button. The validation action will call "$self->_valid()".

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.

A string to display as hiding button label. Default to empty string, meaning no hiding button. The hiding action is to just hide the dialog (think "withdraw").

    $dialog->close;

Request to destroy the dialog.

You can look for information on this module at:
  • Search CPAN

    <http://search.cpan.org/dist/Tk-Role-Dialog>

  • See open / report bugs

    <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Tk-Role-Dialog>

  • Git repository

    <http://github.com/jquelin/tk-role-dialog>

  • AnnoCPAN: Annotated CPAN documentation

    <http://annocpan.org/dist/Tk-Role-Dialog>

  • CPAN Ratings

    <http://cpanratings.perl.org/d/Tk-Role-Dialog>

Jerome Quelin

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.

2022-04-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.