This solution will work fine. A textvariable can be used just like any other variable. If you change it, the display is automatically updated (no need for "edit" commands).As a small enhancement, I show how to use the "filetypes" filter. If the op wants to pass a ref to the textvariable, I show how to do that also although if this is a special purpose routine, I would have no problem with just accessing the $ImageFilePath directly without going through a reference. I also tend not to declare var names that aren't used again (like the LHS of button creation).
# entry textbox for Image times dialog
my $entImageFile = $mw->Entry(-width=>30,
-textvariable=>\$ImageFilePath,)->pack()
+;
# button to browse for file
$mw->Button( -text=>'Browse',
-command=> sub { openImageFileDialog(\$ImageFilePath)},
)->pack();
MainLoop;
sub openImageFileDialog
{
my $path_ref = shift;
my @types =
(["Image Files", [qw/.bmp .giff .tiff/]],
["All files", '*'],
);
$$path_ref = $mw->getOpenFile(-title => 'Open Image File:',
-filetypes => \@types);
}
|