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

Reading Tk Window messages

by Stevo_ie (Initiate)
on Oct 08, 2002 at 13:44 UTC ( #203642=perlquestion: print w/ replies, xml ) Need Help??
Stevo_ie has asked for the wisdom of the Perl Monks concerning the following question:

I need to read all the messages that are sent to a perl/tk window eg. mouse_moved, minimise_button_pressed, window_moved, window_resized.
Does anyone know how to retrieve these messages?
Thanx in advance,
StevoIE

Comment on Reading Tk Window messages
Re: Reading Tk Window messages
by rir (Vicar) on Oct 08, 2002 at 18:18 UTC
    I suspect you need to hack Tk, use some debugging artifact
    or find another definition of your problem.

    Do to the diverse nature of Tk widgets, there is not
    going to be one SUPER class to alter.

    User level coding of Tk seems to only offer:

    $widget-bind( Tk::Button, "<Button-1>", sub{&handle_event});

    which will alter the specified binding for all
    instances of Tk::Button.

Re: Reading Tk Window messages
by PodMaster (Abbot) on Oct 09, 2002 at 12:28 UTC
    I suspect you're after Tk::bind and/or Tk::bindtags.

    see http://perltk.org for tons of information

    update: see what rir said (hmm, i missed it?)

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: Reading Tk Window messages
by ichimunki (Priest) on Oct 09, 2002 at 15:01 UTC
    Take a look at Tk::Toplevel, Tk::Wm, and Tk::after. You can set up a callback that runs periodically in your program to check for some of these things, using $toplevel->geometry() and $toplevel->status()-- this way you can detect when the geometry has changed, or if the user has minimzed or iconfied the application. You can't, unfortunately, directly catch these events as they happen. For that you might want to explore other GUI toolkits that explicitly offer these events as signals.

    One question that I would ask is: why? Tk should handle most of your redrawing needs, and I'm not sure it's interesting to know if the user has tried to minimize the window... unless you're trying to coerce certain behavior.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://203642]
Approved by diotalevi
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2014-12-21 17:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls