Re: Double-click on a Treeview



Does any one have an example of how to track single/double
clicks on a treeview item.

This is for a double click handler.  

BTW: Can someone tell me is there an easy way to pass the event through
so the click can select the row, then return to my function to do my own
handling.

in the init function:
        g_signal_connect(G_OBJECT(regionview), "button_press_event",
                                (GtkSignalFunc)region_click,NULL);

static gboolean
region_click(GtkWidget *widget, GdkEventButton *event, gpointer data){
        gboolean sel;
        GtkTreeIter iter;
        
        if (event->type != GDK_2BUTTON_PRESS){
                return FALSE; /* Do normal handling */
        }

        sel = gtk_tree_selection_get_selected(
                        gtk_tree_view_get_selection(GTK_TREE_VIEW(regionview)),
                        NULL, iter);

        if (sel == FALSE){
                /* Nothing selected - ignore it */
                return FALSE;
        }

        /* Do stuff here */

        /* I've handled it */
        return TRUE;
}

        Regards,
        nash


-- 
Brett Nash <nash nash nu>
Sometimes it's better to light a flamethrower than curse the darkness.



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