Forum: Ruby TK custom events.

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
03a22000d0808f1e35e76aab1a16469d?d=identicon&s=25 PWR (Guest)
on 2006-01-12 14:16
(Received via mailing list)
Hi, does anyone know how to set up a custom event which the Tk main
loop will pick up i.e. I want to be able to create an event/handler
which allows me to dispatch my own events to the Tk main loop. Any help
gratfully received.

Peter.
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2006-01-12 15:01
(Received via mailing list)
From: "PWR" <pw_richards@fastmail.fm>
Subject: TK custom events.
Date: Thu, 12 Jan 2006 22:13:18 +0900
Message-ID: <1137071460.595392.261130@g49g2000cwa.googlegroups.com>
> Hi, does anyone know how to set up a custom event which the Tk main
> loop will pick up i.e. I want to be able to create an event/handler
> which allows me to dispatch my own events to the Tk main loop. Any help
> gratfully received.

To answer your question, more details of your own events are required.
Please explain what kind of events you want to treat.
03a22000d0808f1e35e76aab1a16469d?d=identicon&s=25 PWR (Guest)
on 2006-01-12 15:44
(Received via mailing list)
I'm wanting to do the following,
(1) Monitor an incoming socket with another thread and queue received
messages.
(2) Supply an event to the Tk mainloop when data arrives which causes
it to call a handler which reads the queued data.

The idea is to avoid a solution which involves directly calling Tk
methods from the other thread in case there are any thread safety
issues. I may be being over cautious.

Peter.
Dedb38b3571b323b77bc9b221e940172?d=identicon&s=25 ruby talk (Guest)
on 2006-01-12 17:43
(Received via mailing list)
What if i wanted to get the location of a file that i click and drag
over
lets say a TkButton?

Becker
E4f967492dbd03c526cc9b397e68021d?d=identicon&s=25 Hidetoshi NAGAI (Guest)
on 2006-01-12 18:07
(Received via mailing list)
From: "PWR" <pw_richards@fastmail.fm>
Subject: Re: TK custom events.
Date: Thu, 12 Jan 2006 23:43:05 +0900
Message-ID: <1137076826.731074.204100@o13g2000cwo.googlegroups.com>
> The idea is to avoid a solution which involves directly calling Tk
> methods from the other thread in case there are any thread safety
> issues. I may be being over cautious.

Don't worry about that. :-)
All Tk calls out of the 'Tk.mainloop' thread are automatically
serialized on the event queue and done in the 'Tk.mainloop'.
That is not a work of a user, but a work of 'tcltklib'.

Even though so, if you want to use your own event,
please try TkVirtualEvent and Tk.event_generate.
If those cannot satisfy you, you may have to write C functions.
If so, please read how to treat TclTkIp#invoke method on 'tcltklib.c'.
03a22000d0808f1e35e76aab1a16469d?d=identicon&s=25 PWR (Guest)
on 2006-01-12 18:28
(Received via mailing list)
Problem solved, in fact it never existed! Thanks a lot.

Peter.
This topic is locked and can not be replied to.