The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Wx::Perl::Dialog - Abstract dialog class for simple dialog creation

SYNOPSIS

        my $layout = [
                [
                        [ 'Wx::StaticText', undef,         'Some text entry'],
                        [ 'Wx::TextCtrl',   'name_of',     'Default value'  ],
                ],
                [
                        [ 'Wx::Button',     'ok',           Wx::wxID_OK     ],
                        [ 'Wx::Button',     'cancel',       Wx::wxID_CANCEL ],
                ],
    ];

        my $dialog = Wx::Perl::Dialog->new(
                parent => $win,
                title  => 'Widgetry dialog',
                layout => $layout,
                width  => [150, 200],
        );

        return if not $dialog->show_modal;

    my $data = $dialog->get_data; 

Where $win is the Wx::Frame of your application.

WARNING

This is still an alpha version of the code. It is used mainly by Padre and its plugins. The API can change without any warning.

DESCRIPTION

Layout

The layout is reference to a two dimensional array. Every element (an array) represents one line in the dialog.

Every element in the internal array is an array that describes a widget.

The first value in each widget description is the type of the widget.

The second value is an identifyer (or undef if we don't need any access to the widget).

The widget will be accessible form the dialog object using $dialog->{_widgets_}{identifyer}

The rest of the values in the array depend on the widget.

Supported widgets and their parameters:

Wx::StaticText
 3.: "the text",
Wx::Button
 3.: button type (stock item such as Wx::wxID_OK or string "&do this")
 
Wx::DirPickerCtrl
 3. default directory (must be '')  ???
 4. title to show on the directory browser 
Wx::TextCtrl
 3. default value, if any
Wx::Treebook
 3. array ref for list of values

METHODS

new

get_data

 my $data = $dialog->get_data;
 

Returns a hash with the keys being the names you gave for each widgets and the value being the value of that widget in the dialog.

show_modal

Helper function that will probably change soon...

 return if not $dialog->show_modal;
 

BUGS

Please submit bugs you find on http://padre.perlide.org/

COPYRIGHT

Copyright 2008 Gabor Szabo. http://www.szabgab.com/

LICENSE

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