I am probably reinventing some wheel here so please let me know
what should I use instead of my home grown dialog creation.
Basically I create an array such as this and call the build_layout method of
my "dialog generator" which then creates a
Wx::BoxSizer->new( Wx::wxVERTICAL ), inside it creates rows using
Wx::BoxSizer->new( Wx::wxHORIZONTAL )
and in every row it Adds the widgets as describe in the internal array.
Every widget has a 'type', an optional name so we can later get fetch the data
from it, an argument that is usually its "title" and another optional
argument that
is some widget specific information, usually a default value.
my @layout = (
[
[ 'Wx::StaticText', undef, 'Module Name:'],
[ 'Wx::TextCtrl', '_module_name_', ''],
],
[
[ 'Wx::StaticText', undef, 'Author:'],
[ 'Wx::TextCtrl', '_author_name_', ''],
],
[
[ 'Wx::StaticText', undef, 'Email:'],
[ 'Wx::TextCtrl', '_email_', ''],
],
[
[ 'Wx::StaticText', undef, 'Builder:'],
[ 'Wx::ComboBox', '_builder_choice_', '',
[EMAIL PROTECTED],
],
[
[ 'Wx::StaticText', undef, 'License:'],
[ 'Wx::ComboBox', '_license_choice_', '',
[EMAIL PROTECTED],
],
[
[ 'Wx::StaticText', undef, 'Parent
Directory:'],
[ 'Wx::DirPickerCtrl', '_directory_', '', 'Pick
parent directory'],
],
[
[ 'Wx::Button', '_ok_', Wx::wxID_OK],
[ 'Wx::Button', '_cancel_', Wx::wxID_CANCEL],
]
I have to add the events "manually" but the above made my code a lot cleaner
than earlier.
So I wonder how do others make it easier for themselves to create
dialogs in a relatively clean way?
Two dialogs where I have used this already are:
http://svn.perlide.org/padre/trunk/lib/Padre/Wx/FindDialog.pm
http://svn.perlide.org/padre/trunk/lib/Padre/Wx/ModuleStartDialog.pm
Gabor