Re: Forcing size_allocate?
- From: The Surprises <thesurprises1 attbi com>
- To: gtk-list gnome org
- Subject: Re: Forcing size_allocate?
- Date: Thu, 10 Oct 2002 11:16:06 -0700
On Thu, Oct 10, 2002 at 09:25:35AM -0400, Paul Davis wrote:
> >Fair enough.. I tried registering the expose event for the
> >gnome_canvas_item's to their draw routines and removed the
> >size_allocate event. I cannot get this to work. The graphics do not
> >show up at all now. This is probably because I can't do an initial draw
> >until an expose event, so there's nothing on the screen to 'expose'.
> >Can you offer a suggestion on how I would get around this?
>
> well, my first question, on re-reading your original message and
> noticing that the widget in question in a canvas is what do you mean
> by "all drawing"? canvas items update themselves at the right time,
> and they are placed there generally in response to other events (mouse
> button events, etc.)
>
> putting a canvas item onto the canvas isn't "drawing". by "drawing" i
> meant using functions that ultimately attempt to render
> lines,rectangles,pixmaps etc.
>
> you'll need to explain better what you're doing. if its just resizing
> canvas items when the canvas size changes, you can do all that from
> the size allocate event no problem, because that doesn't cause any
> drawing to take place at that exact moment in time.
>
Looks like I figured it out. Here is what I had to do to get correct
canvas item sizes upon startup.
- Create a vbox, show it
- Create a gnome_canvas
- Pack the canvas into the vbox, show it
- Create a canvas_item (no draw yet) on the canvas
- Connect vbox size_allocate event to the canvas_item's draw routine.
The draw_routine is just a gnome_canvas_item_set ()
Previously I was connecting the vbox's parent's size_allocate to the
draw, which apparently was allocating before the canvas was even
available, so that's probably why it was blank before a manual resize.
Anyway, it seems to work now. Thanks!
Jason
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]