Re: reposition DrawingArea inside a Scrollbar after enlarging
- From: Gang Chen <gang chen cn gmail com>
- To: Hendrik Tews <tews os inf tu-dresden de>
- Cc: gtk-list gnome org
- Subject: Re: reposition DrawingArea inside a Scrollbar after enlarging
- Date: Fri, 15 Jul 2011 09:18:55 +0800
Hi,
Anyone interested? Vote!
Hi Hendrik,
I can't answer the question. I suggest you read some samples, e.g. the
code of the canvas widget, and follow their way to implement a
scrollable customized drawing widget.
Thanks,
Gang
2011/7/8 Hendrik Tews <tews os inf tu-dresden de>:
> Hi,
>
> what is the preferred way to reposition a GtkDrawingArea inside a
> GtkScrollbar just after the GtkDrawingArea has been enlarged?
>
> In detail: I have a DrawingArea (in Gtk 2.20 in Debian squeeze)
> that gets now and then enlarged when new elements are drawn on
> it. For enlarging it I use gtk_widget_set_size_request. The
> DrawingArea sits inside a Scrollbar. After enlarging the
> DrawingArea I want to make sure that the new element, which I've
> just drawn in the new region, is visible. I therefore call
> gtk_adjustment_clamp_page on both scroll bars with appropriate
> lower and upper values. I then call gtk_widget_queue_clear on the
> DrawingArea and let it redraw when the exposure event arrives.
>
> The trouble is that the new element is often outside the visible
> portion of the DrawingArea. So gtk_adjustment_clamp_page does not
> work in this case. AFAICS the problem is that the size does not
> change immediately when I call gtk_widget_set_size_request and
> therefore the call of gtk_adjustment_clamp_page works with the
> old size. When the adjustments finally get the new size they
> forgot about my clamp_page request and the new region with the
> new element in it remains invisible.
>
> When and how should I change the adjustments so that the new
> region in the DrawingArea becomes visible?
>
> Using the size-allocate signal does not work, because apparently
> it is only emitted if my size request is larger then the current
> size. (Sometimes I also delete elements and shrink the
> DrawingArea. But also in these cases I want to ensure that a
> certain current element is visible).
>
> Changing the adjustment in the handler of the exposure event does
> also not work reliably. Sometimes the DrawingArea receives
> exposure events before the size has changed. Therefore I would
> have to set the adjustment on every exposure event, which would
> break the function of the scroll bars.
>
> For screen shots of my application visit
> http://askra.de/software/prooftree/ .
>
> I posted this already on gtk-app-devel, but got no replies there.
>
> Bye,
>
> Hendrik Tews
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]