Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- tk Optionmenu - updating options
April 29, 2009, 6:48 am
rate this thread
-variable => \my $var,
-options => [@options2],
-justify => 'left'
-row => 1,
-column => 1,
-sticky => 'nw'
Initial, I can see "A" & "B" from the drop down list.
Later in the coe, I modify the options2 array.
@options2 = ("C","D");
The gui is not update with the new value. How can I update this?
I tried $mw->update; doesn't work either.
Re: tk Optionmenu - updating options
Without ever having used Perl TK...
... here you are assigning a copy(!) of the values(!) of @options2 ...
Of course not. The array @options2 has no relevance to $mw except that
at one point in its past the values at that time of @options were used
to set some options of $mw.
I don't know what $mw->update does, but I guess you will have to submit
the new values. How should it know what new values to use without you
telling it which values to use.
Maybe, just maybe, -options accepts a reference. In that case you could
just pass a reference to $options2 when creating the original menu.