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



On 17 Mar 2001 20:13:50 +0100, Mark Roberts wrote:
> Dear Oliver!
> 
> > 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.
> 
> You are listening for clicks in the CList, right? If you place something
> in each cell that can itself create signals (almost anything: you probably
> have it in already, unless you're using only Labels in the CList), then
> you can attach a listener (the same listener) to each of those. 
> 
> I hope I'm right, good luck. It's certainly better than checking for the
> (x,y) position, isn't it?
> 
> All the best, Mark

If you're already connecting to the button_press_event then you can use
gtk_clist_get_selection_info() with the x, y coordinates-(event->x,
event->y) to retrieve both the row and column that were clicked on. This
function is documented in the tutorial also.

    Stephen

 






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