rookie_monk has asked for the wisdom of the Perl Monks concerning the following question:
When this button is clicked, I am able to choose a directory. I store the path in $filepath, how to do I access that variable to get the path? I have another button that needs the filepath from this button? Do I need "return $filepath;" at the end of the load_listbox sub? Whats the code I would need to access it? Would it be something like "$thepath = $but_browse=>get();". Thanks in advance!my $mw = MainWindow->new; $mw->title("Something"); my $but_browse = $frm_name -> Button(-text=>"BROWSE", -command =>\&load_listbox) -> pack(-side => 'left'); sub load_listbox { my $filepath = $mw->chooseDirectory() or return(); opendir (DIR, $filepath) || die("Cannot open directory"); $lb->delete(0, 'end'); $lb->insert('end', grep { ! -d } readdir DIR); close DIR; $lb->bind('<Button-1>', sub { $ent4->configure(-text => $lb->get($lb->curselection( )) ); $ent5->focus; }); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Return value from Button event
by zentara (Cardinal) on Sep 07, 2010 at 18:29 UTC | |
|
Re: Return value from Button event
by Anonymous Monk on Sep 07, 2010 at 16:35 UTC | |
|
Re: Return value from Button event
by dasgar (Priest) on Sep 07, 2010 at 18:13 UTC |