Hi, I'm starting to write gui applications, I've never seen nothing about 'frames and windows' ...
I have a problem:
my $MW = MainWindow -> new;
my $menubar = build_menubar;
my $frame = $MW->Frame(qw/-width 300/)->pack;
my $text = $MW->Text()->pack;
# How can I access to this ($text) 'component' on 'select_file sub'?
sub build_menubar {
my $menubar = $MW->Menu;
$MW->configure(-menu => $menubar);
my $file = $menubar->cascade(-label => '~File');
$file->command(-label => "Open", -command => [\&select_file, $MW]);
$menubar; # return the menubar
}
...
in other file:
my $file = 0;
sub select_file
{
my $MW = $_[0];
my $fs;
$fs = $MW->FileSelect
(-directory => Cwd::cwd(),
-initialfile => "fileselect.pl",
-filter => "*.pl",
-filelabel => "Fichero",
-filelistlabel => "Lista fich",
-dirlabel => "Directorio",
-dirlistlabel => "Lista dir",
-verify => ['-T']
);
$file = $fs->Show;
my $label = $MW->Label(-text => "Your file: $file"
;
$label->pack;
}
sub nombre_fichero
{
return $fichero;
}
1;
I'd like I could write file content in my textbox, when I open it from menu.
I don't know how to access to my textbox when I'm on 'select_file' sub.
Isn't there a 'select' sub.
I'd like can do something like:
my $text = $MW->Text(-name => "my_text_box"
;
...
on select_file:
my $text = $MW->select("my_text_box"
;
Which is select function?
Do you understand my problem?
Thanks you, sorry for my poor english
I have a problem:
my $MW = MainWindow -> new;
my $menubar = build_menubar;
my $frame = $MW->Frame(qw/-width 300/)->pack;
my $text = $MW->Text()->pack;
# How can I access to this ($text) 'component' on 'select_file sub'?
sub build_menubar {
my $menubar = $MW->Menu;
$MW->configure(-menu => $menubar);
my $file = $menubar->cascade(-label => '~File');
$file->command(-label => "Open", -command => [\&select_file, $MW]);
$menubar; # return the menubar
}
...
in other file:
my $file = 0;
sub select_file
{
my $MW = $_[0];
my $fs;
$fs = $MW->FileSelect
(-directory => Cwd::cwd(),
-initialfile => "fileselect.pl",
-filter => "*.pl",
-filelabel => "Fichero",
-filelistlabel => "Lista fich",
-dirlabel => "Directorio",
-dirlistlabel => "Lista dir",
-verify => ['-T']
);
$file = $fs->Show;
my $label = $MW->Label(-text => "Your file: $file"
$label->pack;
}
sub nombre_fichero
{
return $fichero;
}
1;
I'd like I could write file content in my textbox, when I open it from menu.
I don't know how to access to my textbox when I'm on 'select_file' sub.
Isn't there a 'select' sub.
I'd like can do something like:
my $text = $MW->Text(-name => "my_text_box"
...
on select_file:
my $text = $MW->select("my_text_box"
Which is select function?
Do you understand my problem?
Thanks you, sorry for my poor english