views:

170

answers:

1

I am attempting to fix the size of a widget in GTK+, specifically using Gtk2hs with Haskell.

I have drawn an image in a DrawingArea and I would like to specify the exact size of this drawing area. I do not want other widgets or the user to make this widget larger or smaller. Is this possible?

Note, I am using ghc version 6.10.4 under Ubuntu 9.10. Gtk2hs version 0.10.1.

+1  A: 

You can call gtk_widget_set_size_request() to cause a widget to request a fixed height and width. You'll have to determine the Haskell equivalent.

Note that this is generally a Bad Idea(TM) and you should arrange your containers and child packing properties such that your controls are sized appropriately. For example, changing the size of your image will require code changes if you're hardcoding size request values.

anthony
Thanks. This was halfway to fixing my problem. I also needed to place it inside a Fixed pane (as opposed to HBox or VBox, say) to prevent the enclosing widget from resizing the DrawingArea.
Vespasian