Re: [Gtk-sharp-list] DrawingArea - allocating needed space



Piotr Zurek wrote:

Anyway, I need a word of advice on using DrawingArea.
In my application the user is supposed to draw all elements in all directions around one central element. Let's say that I start with an empty drawing and I draw the first element in the center of the area allocated for the my drawing. The application automatically places all elements so that they do not overlap. Sooner or later the user hits a point where the allocated area is not enough. I have to allocate some more space. It's not a problem if it grows to the right or down - I can use SetSizeRequest to grow it. But what if it has to grow to the left or up? Do I have to move the the central element from the initial position evey time I need to make some more space for elements above or on the left? I think I could probably do it that way but maybe somehow I can use the SizeAllocate (or something else) and use negative values for my drawing coordiantes?

If you're able to move the drawn elements, another possibility is to destroy the drawing area and recreate it with the new dimensions, and then redraw from your starting point. Assuming you're using a Gdk.Pixmap, it'll be a simple matter of displaying the contents again.



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