Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re: Tk:::Optionmenu startup displaying the optionlist ( tk optionmenu bug , event generate)by Anonymous Monk |
on Feb 04, 2015 at 00:45 UTC ( [id://1115465]=note: print w/replies, xml ) | Need Help?? |
Is there a method to have Tk::Optionmenu start displaying the option list without having the user first click the button? Yes, generate a tk event, or call the appropriate Tk::Optionmenu method directly, Tk::WidgetDump might help you figure stuff out or, use a widget other than Tk::Optionmenu, maybe a Tk::Listbox or something else, like a frame or panel of buttons that you create Question 2: Why does the Optionmenu callback function (localCall below) get called before the user click of Optionmenu button? What does the documentation say about it? https://metacpan.org/pod/Tk::Optionmenu#command I would assume because the Tk::Optionmenu calls it, because its written that way :) ... and this is probably a bug but it might be a feature; -options is loaded and a default option is selected after the -command is bound ... so the -command callback gets invoked Please look at my workaround. Yup, akward :) I don't recognize any part of the program as a workaround In each callback you can use $Tk::event and $Tk::widget ... combine with ->parent, and no need for some of those closures
In Section
Seekers of Perl Wisdom
|
|