[Glade-users] Sending events (somewhat OT)

On Sat, Mar 14, 2009 at 12:28 AM, Steve Blackwell <zephod at cfl.rr.com> wrote:
I have written a program using glade 3 that has 2 threads. The main
thread handles user input from the GUI while the second thread monitors
a USB port for input. When data arrives at the USB port, it is processed
and written to a GtkTreeView widget.

The problem is that the data does not appear in the TreeView until I
move the mouse or press a key. I think that this is because the main
thread controlling the GUI is blocking in gtk_main() until an event
arrives. So I added code to the second thread to send a
GDK_CLIENT_EVENT to the GtkDialog widget that contains the TreeView.

It didn't work.

When you recieve data from your USB in your worker thread; call
g_idle_add() to schedule a one time idle function in the main thread.

From that function - call gtk_widget_queue_draw() on your treeview.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]