Re: GtkCList - how to find which cell was clicked?

What I did was hook up my "button-press-event" to a callback
and then use gtk_clist_get_selection_info() so you can get the
row and column by using the x and y coordinates of the event
that's passed into your handler. So, it looks something like this:

void right_click_item(GtkWidget *widget, GdkEventButton *event, gpointer data)
   gint row, column, res;

   if(event->button == 3) /* Was right-clicked */
      res = gtk_clist_get_selection_info(GTK_CLIST(widget), event->x,
                                         event->y, &row, &column);

      if(res) /* We had a valid right-click */
         /* Handle the right-click on that particular row/column */

Hope this helps!

Jeff "Shippy" Shipman     E-Mail: shippy nmt edu
Computer Science Major    ICQ: 1786493
New Mexico Institute of Mining and Technology

On Sat, 17 Mar 2001, Oliver Elphick wrote:

> I would like to have my application respond to a right-click in any
> particular cell of a GtkCList by displaying further data about that cell's
> contents.  I am responding to a button-press event and seeing if it was the
> right-button that was pressed.
> At present, I can't see how to discover which cell the mouse pointer is in
> when the button-press event occurred.
> Is this possible, or should I use a different approach altogether?
> --
> Oliver Elphick                                Oliver Elphick lfix co uk
> Isle of Wight                    
> PGP: 1024R/32B8FAA1: 97 EA 1D 47 72 3F 28 47  6B 7E 39 CC 56 E4 C1 47
> GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
>                  ========================================
>      "Dearly beloved, avenge not yourselves, but rather give
>       place unto wrath; for it is written, Vengeance is
>       mine; I will repay, saith the Lord."
>                                   Romans 12:19
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org

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