Re: Capturing which row is double-clicked in clist



On 2002.01.08 08:53 Dean W. Schumacher wrote:
I've come across a problem with determining which row a user has
double-clicked in a clist. Normally, I can determine which row
is selected by checking clist->selection; however, if the row
was previously selected by the user, and then he double-clicks
on it, apparently it unselects the row before capturing the
double-click event because clist->selection is NULL. 

Does anyone know how to work around this?

Okay, first attach a signal handler for "button_press_event"
and use gtk_signal_connect_after() for your GtkCList.

Then in your callback handler, use:

gint ButtonPressEventCB(
        GtkWidget *widget, GdkEventButton *button, gpointer data
)
{
            gint row, column;
            gint etype;
            gint rows_selected = 0, selected_row = -1;
            GList *glist;
            GtkCList *clist = GTK_CLIST(widget);


            etype = button->type;

            /* Find row and column based on given coordinates. */
            if(!gtk_clist_get_selection_info(
                clist, button->x, button->y, &row, &column
            ))
            {
                row = -1;
                column = 0;
            }

            /* Is it a double click? */
            if(etype == GDK_2BUTTON_PRESS)
            {
                /* Do double click routine here. */



            }

            return(FALSE);
}



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