Re: (no subject)



On Fri, 24 Aug 2001 09:25:15 -0400 (EDT), Angelo Jerod Keresztes said:

I have a simple problem, but dont know exactly how to fix it.
 
 I have a few  GtkWidgets(pixmaps) that are packed into a
 GtkScrolledWindow.
 
 I need to get button_press events on the pixmaps themselves (so I know
 which pixmap has been selected).  but nothing happens when I connect a
 signal.  Here's a snippit of how I connect the signal:
 
      gtk_signal_connect( GTK_OBJECT(my_pixmap_widget),
                                  "button_press_event",
                             GTK_SIGNAL_FUNC(pixmap_handler_event),
                             NULL );
 
 Now if I connect the signal to the GtkScrolledWindow, the button pressed
 events work, but I dont know which pixmap has been selected.
 
 I need to know which pixmap has been selected, and they're packed inside
 the ScrolledWindow.
 
 How can I get the button_press_event to work on the pixmap widgets?

There are two ways to do this, first check if the scrolled window
has GdkWindow by using GTK_WIDGET_NO_WINDOW(scrolled_window).

Then if it has a GdkWindow, you'll want to connect the
"button_press_event" signal to it and on each event you want to check
the coordinates and offset with the scrolled window's adjustments.

That would be the more memory efficient way, the other way is to
create a GtkEventBox for each GtkPixmap, parent the pixmap into
the event box and then put the event box on to the scrolled window...
you might want to first pack a GtkFixed into the scrolled window
then pack the event boxes in to the fixed, so you can set a particular
position with gtk_fixed_put().


-- 
--
Sincerely,                  ,"-_                         \|/
-Capt. Taura M.             ,   O=__                    --X--
.__                          ,_JNMNNEO=_                 /|\
OMNOUMmnne.                  {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn.               'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe              '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe.                "7OMMMMNNNNNWWEEEEOOOOOO"   "'.
EEBNNMMMNWNWWEEIMMNe.             __  7EMMMNNNNNWWWEEEEEEEOO.     " .
NNMMMMWWWMMMWEINMMMNn            "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._     .
                  http://furry.ao.net/~learfox/






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