Re: gtk widget events (was: gtk_widget_set_name)

By default the drawing area isn't set up to receive button press events.
You have to explicitely change this by adding a call to:


after its construction.

Then your program works just fine.


On Mon, May 27, 2002 at 12:09:40AM +0200, Riswick, J.G.A. van wrote:

Yes you are right, thanks. In the meantime, I managed
to locate the manpage (Gtk::reference) and also found it 

Some time ago, I wrote a gtk program and now I'm trying
to convert it to gtk-perl. I stumbeled upon something that
I can't get to work. In my gtk program I connected a signal
handler to a drawing area like this:

               (GTK_OBJECT(drawingarea), "event",
                   (GtkSignalFunc)area_event, (gpointer)drawingarea);

Now I'm trying to do the same using gtk-perl (sample below). The
callback function seems to get called, but filtering out the 
button_press event doesn't work. does anyone know what I'm doing



#!/usr/bin/perl -w

use Gtk;
init Gtk;

$win = new Gtk::Window;

$drawingarea = new Gtk::DrawingArea();
$drawingarea->signal_connect('event' , \&cb );

sub cb {

   my ( $widget, $data, $event ) = @_; 

 if ( ( defined( $event->{'type'} ) ) and
      ( $event->{'type'} eq 'button_press' ) )
     if ( $event->{'button'} == 3 )

  return 0;


main Gtk;

-----Original Message-----
From: Dermot Musgrove
To: Riswick, J.G.A. van
Cc: 'gtk-perl-list gnome org'
Sent: 5/26/2002 6:38 PM
Subject: Re: gtk_widget_set_name

"Riswick, J.G.A. van" wrote:


Is it possible to access the function gtk_widget_set_name()
using gtk-perl? This lets the user link styles in the gtkrc
file to a widget.
Hi, I reckon so - Gtk::Widget->set_name() so for instance:

    $clist->set_name('New name');

regards, Dermot

gtk-perl-list mailing list
gtk-perl-list gnome org


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