pdm
pdm

Reputation: 1107

GtkPaned move-handle signal from mouse?

Reading through a GTK+ tutorial and I wanted to print out a message any time the pane handle was moved, and print it's position along with that. So...

g_signal_connect(G_OBJECT(hpaned), "move-handle", G_CALLBACK(resized), GTK_PANED(hpaned));

...

void resized(GtkPaned *paned)
{
    g_message("Something like %d!", gtk_paned_get_position(paned));
}

Except that only prints out the location when I press a scroll button (arrows, page keys, etc). That makes plenty of sense based on the documentation... but, what about getting a signal from a click-and-drag event? Surely that's a more common way to resize a pane than moving it with the arrow keys?

Upvotes: 3

Views: 548

Answers (1)

user4815162342
user4815162342

Reputation: 155650

As the documentation points out, move-handle is a keybinding signal, which is not what you want here. To observe all moves of the handle, connect instead to the notification signal of the position property:

g_signal_connect(G_OBJECT(hpaned), "notify::position",
                 G_CALLBACK(resized), GTK_PANED(hpaned));

Upvotes: 4

Related Questions