[MonoDevelop] Auto-size of DrawingArea derived widgets

Paweł Wieczorek wieczyk at gmail.com
Sun Feb 21 22:03:47 UTC 2016


I cannot figure out how to use custom widgets based on the Gtk.DrawingArea
widget. I see that designers behaves differently for DrawingArea from
Toolbox and for my widgets based on the Gtk.DrawingArea class.

Lets see some minimal example. Lets use designer to create a window with
HBox with 2 columns. On the left column create TextView widget and on the
right create DrawingArea.

Widgets created in this way behaves normally. It means that the TextView
widget will get half of the window and the DrawingArea widget will get
second half.

Now, lets create a some Gtk.DrawingArea derivative:

    public class OtherDrawingArea : Gtk.DrawingArea
        public OtherDrawingArea()

As you can see this class does nothing. I would expect that it behaves
identically to the DrawingArea widget from the Toolbox, but it doesn't.

When I drag 'OtherDrawingArea' on the right column then I see that designer
(gtk?) gives whole window to the TextView.

I was analyzing generated ::Build method and I have found that for
OtherDrawingArea designers puts those lines:

w3.Expand = false;
w3.Fill = false;

while It does not put similar lines for DrawingArea from Toolbox. Why? What
is a difference between DrawingArea from Toolbox and OtherDrawingArea? How
to control generation of those lines?

On the properties window I see that both DrawingArea and OtherDrawingArea
have set "Auto Size" property to True and disabled "Expand" and "Fill"
properties. I do not see any property which could differentiate DrawingArea
from Toolbox and OtherDrawingArea widgets.

I am using MonoDevelop 5.9.6.

Best regards,
Paweł Wieczorek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodevelop-list/attachments/20160221/e3b53bd1/attachment.html>

More information about the Monodevelop-list mailing list