Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Confusing behavior from Tk::BrowseEntryby kcott (Archbishop) |
on May 25, 2020 at 00:23 UTC ( [id://11117212]=note: print w/replies, xml ) | Need Help?? |
G'day DcmbrAgnt, You really haven't shown enough code to be certain; however, I suspect your problem may lie with this:
The $midi_indev is a package (global) variable. You don't actually use it in the sub where it's assigned a value. As you don't show any code where $midi_indev is also used, I won't speculate further. You should be using the strict and warnings pragmata: see "perlintro: Safety net". What you probably need to do is create a reference to $midi_outdev before constructing the Tk::BrowseEntry widget. Then use that reference something like this:
Here's a very bare-bones example:
This code is fully functional. It always shows 'A' as the initial selection; it always prints the last selected value whenever the "Print Choice" button is used. "... ALSA MIDI ports, which are being scanned with MIDI::ALSA and put into an array long before the BrowseEntry widget ever gets configured or displayed." There may also be something wrong about that assertion. Do you know for certain or is that an assumption? Without seeing your code, I can't tell. If the above suggestions don't help, please create an SSCCE that reproduces your problem. Do keep it short: unless it's relevant, omit anything to do with colours, fonts, justification, and so on. You might also like to take a look at the Widget Demo. In case you don't know, just type widget on the command line. I can see two examples using Tk::BrowseEntry under Tix Widgets (items 2 & 3). — Ken
In Section
Seekers of Perl Wisdom
|
|