Re: Capturing which row is double-clicked in clist
- From: "Dean W. Schumacher" <dean schumacher alcatel com>
- To: Johan Bondeson <nahoj84 hotmail com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Capturing which row is double-clicked in clist
- Date: Tue, 08 Jan 2002 13:12:41 -0600
Johan Bondeson 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?
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
--------------------------------------------------------------
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
Thanks for the suggestion. I thought about that, but I was hoping
that I was just missing something and there was a more "correct" way
of handling it. In most cases, you can get the row number from
clist->selection, so having to store it separately in a variable
just doesn't seem right, but that's what I'll have to do if I can't
get it using a GTK call or structure.
It doesn't make sense to me that clist->selection should be set to
NULL in this case.
Regards,
--
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]