Re: GtkPaned problems!



On Wednesday 14 January 2004 21:46, Mikael Brorsson wrote:

I have a huge problem with the GtkPane widget... I have connected the
handle_move signal from the widget in the right way.

g_signal_connect ((gpointer) vpaned1, "move_handle",
                    G_CALLBACK (on_vpaned1_move_handle),
                    NULL);

But the on_vpaned1_move_handle is never called. I can pull in the handle
for weeks... no reaction.


IIRC, "move-handle" is a keyboard binding thing, and not a signal emitted when 
the handle is moved.

Try something like this:


static void
onHandlePositionChanged (GObject *pane, GParamSpec *pspec, gpointer data)
{
        g_print("handle position changed to: %u\n",
                      gtk_paned_get_position(GTK_PANED(pane)));
}


void
set_up_stuff (void)
{
     ...
     g_signal_connect(paned, "notify::position"
                                     G_CALLBACK(onHandlePositionChanged),
                                     NULL);
    ...
}


The "notify" signal will be emitted whenever an object's property changes. As 
the handle position is a GtkPane property, we can use that to be notified of 
handle position changes. The '::position' bit after the signal means that you 
only want to be notified when the 'position' property changes.

Cheers
-Tim







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