Re: Emitting a signal leads to a failed assertion
- From: Ari Jolma <ari jolma tkk fi>
- To: gtk2-perl List <gtk-perl-list gnome org>
- Subject: Re: Emitting a signal leads to a failed assertion
- Date: Sun, 04 Nov 2007 12:47:34 +0200
muppet kirjoitti:
How do I then react to the user scrolling?
By connecting to the value-changed signals on the vertical and
horizontal adjustments.
In your example you create the ScrolledWindow with two adjustments.
In my case I want to manage the adjustments (and the image that's
shown) within the Overlay (subclass of ScrolledWindow) object. Gnome
docs say: "Usually you want to pass |NULL|
<http://library.gnome.org/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#NULL:CAPS>
for the adjustments, which will cause the scrolled window to create them
for you." Ok, that's what I want but then
$self->get_hadjustment()->signal_connect(value_changed =>
\&value_changed, $self);
does not seem to work, but
$self->get_hscrollbar()->signal_connect(value_changed =>
\&value_changed, $self);
does. That's what you say too:
but if you're going to connect to signals on them, you'll have to watch the ScrolledWindow's adjustment
properties' notify signals for changes
hm, how do I do this?
I realized that the heart of the problem is here. In the render
method, I redraw the image and set the adjustments.
Ack! That sounds like your problem. Don't *set* the adjustments,
*change* the adjustments.
:) In the docs I see only a method for changing the *value*. The
(virtual) size of the thing in an Overlay window changes often and thus
I also need to change the *upper* of the adjustment.
To give more concrete advice, i really need to have a better idea of
how your stuff is actually laid out.
As I wrote, the whole design was bad since it called the render twice. I
changed it so that it now emits a signal just before that image is
constructed to give users the last chance of changing the data before it
is rendered. That removes the double rendering and fills all
requirements. The scrolling works although it seems to implemented in a
bit unusual way.
A easiest way to look at how the code works is perhaps to download the
lastest build (Windows, but still) from
http://map.hut.fi/files/Geoinformatica/snapshots/Geoinformatica-03-11-07.zip
(30MB). It should work out of the box and you can open any png or jpeg
images to see how the scrolling works with the simple app that's
included although it is meant for geospatial data. The Perl code is of
course in the usual place (site/lib/Gtk2/Ex/Geo/Overlay.pm).
Thanks,
Ari
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]