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

Re: Mouse buttons 2 and 3 in CList



On Tue, 1 Jul 2003 mquezada@nlxcorp.com wrote:

> 
> Seth,
> 
> Thanks for the tip. Unfortunately I have to tie the button press to a
> widget. If I tie it to the CList then I don't get the column and row infor
> I need. Is there any way to obtain this that you know?

Fortunately there is. You will need to use the 
gtk_clist_get_selection_info() function like this...

gint r, c;
...
gtk_clist_get_selection_info(GTK_CLIST(widget), (gint)event->x, 
(gint)event->y, &r, &c);

... where widget is the clist that emitted the "button_press" event. The r 
and c variables will be filled with the row and column that received the 
mouse click.

-Seth

> 
> 
> Marco Quezada
> Aerospaceo Engineero
> NLX Corporation
> 22626 Sally Ride Dr.
> Sterling, VA, 20164
> 703-234-2100  ext. 1028
> 
> 
>                                                                                                                                        
>                       Seth Remington                                                                                                   
>                       <sremington@saber        To:       mquezada@nlxcorp.com                                                          
>                       logic.com>               cc:       gtk-app-devel-list@gnome.org                                                  
>                                                Subject:  Re: Mouse buttons 2 and 3 in CList                                            
>                       07/01/2003 03:07                                                                                                 
>                       PM                                                                                                               
>                                                                                                                                        
>                                                                                                                                        
> 
> 
> 
> 
> On Tue, 1 Jul 2003 mquezada@nlxcorp.com wrote:
> 
> > I have a CList (gtk 1.2.xx) and it responds to the left (#1) mouse button
> > clicks with the "select_row" signal connected to it. I'd like to add
> other
> > functionality using the other mouse buttons. Is there any example
> available
> > of how to get the other buttons to respond in this manner?
> 
> You are probably going to want to connect to the "button_press" event
> instead of the "select_row" event. Your callback will get passed a
> GdkEventButton pointer that has all kinds of useful information in it.
> 
> I use it like this (assuming my callback gets passed a GdkEventButton
> *event):
> 
> if(event->type == GDK_2BUTTON_PRESS && event->button == 1)
> 
> This would check for a double click with the left mouse button as an
> example. Lot's of good information here...
> 
> http://developer.gnome.org/doc/API/gdk/gdk-event-structures.html
> 
> -Seth
> 
> Seth Remington
> SaberLogic LLC
> 661-B Weber Drive
> Wadsworth, OH 44281
> Ph: 330.355.6442 Fax: 330.336.8559
> 
> >
> > Thanks.
> >
> >
> > Marco Quezada
> > Aerospaceo Engineero
> > NLX Corporation
> > 22626 Sally Ride Dr.
> > Sterling, VA, 20164
> > 703-234-2100  ext. 1028
> >
> >
> > _______________________________________________
> > gtk-app-devel-list mailing list
> > gtk-app-devel-list@gnome.org
> > http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> >
> 
> 
> 
> 
> 
> 
> 




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