|Perl: the Markov chain saw|
Tk Optionmenu - how to set the default selectionby Minok (Novice)
|on Feb 09, 2009 at 20:39 UTC||Need Help??|
Minok has asked for the wisdom of the Perl Monks concerning the following question:
I've been using Optionmenu to implement the ability of users to select a specific configuration option in the software.
I would like to control which option is the selected value (default) when the Optionmenu is first.
The current usage has me setting -textvariable to the variable I use to track the value.
I build a has to track the values that can be used in the menu (the hash values are arrays that are suboptions to drive another Optionmenu).
The problem I'm having is that once the widget is rendered, the value of the selection appears to be the last option added to the widget. What I would like to see happen is for the selection to properly reflect the $defaultPlatform value I set the variable to. Thats not rendering however.
What I see is the widget is set up so that my $defaultPlatform is the starting selected value, however what is shown on the display screen is not that value, but the last option added.
So in the code snippet, the default is Mod1. The Optionmenu does seem to internally store that value as the selected option (based on what I see inside the callback that is executed), but the screen displays Mod2 on the widget.
Maybe its just a matter of forcing an update to the widget? If so, how is that done?