[Mono-devel-list] advice on portable UI coding

Miguel de Icaza miguel at ximian.com
Mon Sep 1 11:34:36 EDT 2003


> To demonstrate difficulties that we encounter: A SWF-button is a Container
> and can embed multiple other widgets (like Images, labels and other stuff).
> A GtkButton can only embed a GtkLabel-widget. Using Gtk-Sharp it is afaik
> not yet possible to replace this GtkLabel-widget with for example a GtkHBox
> or a GtkContainer or ... So you will have to fallback on the plain C gtk-API
> for this feature to be compatible with the SWF-button. -yes, its fun :) but
> not always easy-.

Well, you can do that, just use the parameter-less constructor (new
Gtk.Button) and add the widgets to it.  

Anyways, the above has a problem: it does not follow the Windows.Forms
layout system which:

	* Allows any control to have multiple children (yes, even a label).

	* Each child is positioned with absolute positioning.

The current Control has a Gtk.Layout container that can be used for
this purpose: instead of adding things directly in the Gtk hierarchy
(ie, an image or a label, or a box) *inside* the Button, you add it to
the Gtk.Layout widget that is part of the Button control.


More information about the Mono-devel-list mailing list