Re: Capturing which row is double-clicked in clist



Using gtk_signal_connect_after() instead of gtk_signal_connect()
solved the problem!  

Thanks!
Dean

Taura Milana wrote:

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);
}
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

--
Dean Schumacher                 Email: dean schumacher alcatel com
Software Engineering Tools      Phone: 972.519.3252
Alcatel USA



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