Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Tk programmatically monitor change in Listbox

by jcb (Priest)
on Jan 06, 2020 at 01:41 UTC ( #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
Node Status?
node history
Node Type: note [id://11111021]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (8)
As of 2020-06-04 20:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?