Re: Capturing which row is double-clicked in clist



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?

Here's some example code. I have this C++ function defined as
an event handler for the button press event:


bool on_select_prod_clst_button_press_event (GtkCList *clist,
                                             GdkEvent *event,
                                             gpointer *data)
{
    if (event->type==GDK_2BUTTON_PRESS) {

        if (!clist->selection) {
            cout << "Double-clicked, but no row selected" << endl;
            return true;
        }

        // Do processing here for row user double-clicked on ...

    }
    return true;
}


If the row was already selected when the user double-clicked
on it, then the condition (!clist->selection) is true and I
don't know what row they double-clicked on. Any ideas/solution?

Thanks,
--
Dean Schumacher                 Email: dean schumacher alcatel com
Software Engineering Tools      Phone: 972.519.3252
Alcatel USA
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


--------------------------------------------------------------
Well, I'm not an expert but what about saving the previously selected row in a variable and if clist->selection equals NULL assuming that it was the previously selected row (the one our vriable points to) that was double-clicked.

/Johan Bondeson


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.




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