Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Tk programmatically monitor change in Listbox

by jcb (Parson)
on Jan 06, 2020 at 01:41 UTC ( [id://11111021]=note: print w/replies, xml ) Need Help??


in reply to Tk (Tcl::Tk) programmatically monitor change in Listbox

You will need to subclass Tk::Listbox and override the relevant methods.

Trapping programmatic changes to the UI is probably a bad idea, however, and you should arrange for a notification to be processed by some other means. Tk works very well as the "V" in "MVC", so you will probably get much cleaner code if you have a method in another object that represents whatever the listbox choices are. Preserve that separation and your code will be easier to maintain. Right now, your code seems to be headed towards "tissue of hacks" and Big Ball of Mud.

Sadly, Tk does not appear to have a mechanism for passing generic program-generated events to callbacks.

Replies are listed 'Best First'.
Re^2: Tk programmatically monitor change in Listbox
by Anonymous Monk on Jan 06, 2020 at 10:23 UTC

    Sadly, Tk does not appear to have a mechanism for passing generic program-generated events to callbacks.

    sure it does.

      What is it? Where is it documented? How do I register a handler for an application-specific high-level event and how do I send that event to fire the handler? Can I add other details to the event itself or do I need a separate queue for additional information?

        What is it? Where is it documented? How do I register a handler for an application-specific high-level event and how do I send that event to fire the handler? Can I add other details to the event itself or do I need a separate queue for additional information?

        Go fish ? Yuup

      Thanks. You're super helpful.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-25 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found