in reply to variable access

See Tk::BrowseEntry, you don't need to use variable option, the callback gets the option text
#!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::BrowseEntry; Main( @ARGV ); exit( 0 ); sub Main { GoTk(); GoTk(); } sub GoTk { my $mw = tkinit; my $b = $mw->BrowseEntry( -browsecmd => \&tura, )->pack; $b->insert("end", "Tapioca"); $b->insert("end", "Figgy duff"); $b->insert("end", "Haggis"); $mw->MainLoop; } sub tura { print "@_\n"; } __END__ $ perl tk-scope-BrowseEntry-tura.pl Tk::BrowseEntry=HASH(0xb9298c) Haggis Tk::BrowseEntry=HASH(0xb9298c) Tapioca Tk::BrowseEntry=HASH(0xb9298c) Figgy duff Tk::BrowseEntry=HASH(0xfb3844) Figgy duff

Replies are listed 'Best First'.
Re^2: variable access
by aioan1 (Acolyte) on Jan 06, 2015 at 12:27 UTC
    Thank you! I will try to adapt your code, but I'm not looking for the list from BrowseEntry, I need a value (unique) from a querry from a MongoDB when I select a value from the list.

      Thank you! I will try to adapt your code, but I'm not looking for the list from BrowseEntry, I need a value (unique) from a querry from a MongoDB when I select a value from the list.

      Um, ok ... see Re: Tk: Creating label in hash (I almost wrote one of these again, but I guess I got confused as to your question)

      If that doesn't help, need more info, for example, where is the value of $tura supposed to end up?