Re: Problems with 'signal_emit_by_name';



On 04/19/01 Paul Schulz wrote:
I'm drawing on a pixmap, (the backing pixmap for a Drawing Area) in a
script copied from 'chart-demo.pl' example.

This is working very well except that I can't get the script to update
my changes to the screen.  If I resize the window, or move over it
then it gets a refresh event and displays correctly.

What is the correct thing to do here? Emit an expose signal for the
parts of the image that I've changed?

I get an error if I use 'signal_emil_by_name', and either I'm missing
something in the documentation, or it's wrong.

Emitting signals is not a mechanism a normal application should use:
they are intended mostly for widget implementors that know what they 
are doing... This is even more true when synthetizing events.

In your case you probably want to do a simple:

        $widget->queue_draw_area ($x, $y, $width, $height);

The tutorial suggests only a single parameter.. 

If the tutorial suggests the use of signal_emit, it should probably be
changed to suggest something else (unless it is in the context
of custom widgets).
signal_emit() has one mandatory argument (the name of the signal)
and any other argument that is proper to the signal, so, to
use it you need to know what arguments it requires and of what type.

If I do this for the Drawing area widget, I get an error...
The following works, 

  $widget->signal_emit_by_name( 'expose_event', 'area' );

The expose_event signal requires a Gtk::Gdk::Event as second argument
and this is not the right way to emit it anyway, you should emit an
'event' signal instead.

lupus

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better




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