Beefy Boxes and Bandwidth Generously Provided by pair Networks
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??


in reply to Tk:::Optionmenu startup displaying the optionlist

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

  • Comment on Re: Tk:::Optionmenu startup displaying the optionlist ( tk optionmenu bug , event generate)

Replies are listed 'Best First'.
Re^2: Tk:::Optionmenu startup displaying the optionlist ( tk optionmenu bug , event generate)
by Anonymous Monk on Feb 04, 2015 at 08:02 UTC
    $cm->update; $cm->Post;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1115465]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-25 18:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found