Re: double click event in a tree view
- From: Olexiy Avramchenko <olexiy irtech cn ua>
- To: paolo borelli <pborelli katamail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: double click event in a tree view
- Date: Tue, 29 Apr 2003 20:27:28 +0300
paolo borelli wrote:
On Mon, 2003-04-28 at 19:02, paolo borelli wrote:
Hi,
I'm implementing a dialog which contains a list of symbols implemented
with GtkTreeView/GtkListStore.
I've implemented the dialog as a subclass of GtkDialog and the
application runs it with gtk_dialog_run.
Now I want to intercepet if the user double-click on an elemente of the
list so that I can return the proper GTK_RESPONSE.
Looking at the docs it's not clear to me which event should I connect
to. Can someone give me a hint?
sorry to reply to myself, but re-reading my mail I see I've not been
clear;
I've connected my tree view to the button-press-event with:
/* when a symbol is double-clicked we emit a OK response */
g_signal_connect (G_OBJECT (GTK_WIDGET (dialog->list)), "button-press-event",
G_CALLBACK (gkd_on_double_click), dialog);
where the callback is:
static void
gkd_on_double_click (GtkWidget *widget,
GdkEventButton *bevent,
gpointer *dialog)
{
if (bevent && (bevent->type == GDK_2BUTTON_PRESS))
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
}
The problem is that the above code gets all button-press-events and the
user cannot select another row of the list with the mouse...
ciao
paolo
Hello,
"button-press-event" expects callback that returns gboolean value
(FALSE: continue signal emission, TRUE: stop it). Your callback has
'void' return type - so you'll get random result (in most cases: TRUE).
NOTE: *all signals* with names like "*event" expects *gboolean* return
value from callback.
Olexiy
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]