From: Olivier Andrieu MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <16257.36788.590116.529950 at akasha.ijm.jussieu.fr> Date: Mon, 6 Oct 2003 17:52:20 +0200 To: Richard Jones Cc: lablgtk at kaba.or.jp Subject: Re: Commonly annoying things about lablgtk/gtk In-Reply-To: <20031006150644.GB17693 at redhat.com> References: <20031006150644.GB17693 at redhat.com> Richard Jones [Monday 6 October 2003] : > Although I've been using lablgtk for quite a while, I still haven't > got my head round the difference between vbox#pack and vbox#add, and > the ~expand and ~fill arguments to #pack. It all appears to be fairly > random, and I spend much time trying a combinatorial range of > variations to get the effects I want. Is there any coherent > documentation on this subject? Basically, if there's a #pack method, use it, otherwise, use #add. The GTK tutorial has a chapter "Packing Widgets" http://www.gtk.org/tutorial/ch-packingwidgets.html with a "packing demo" program. > Also, this must be a common question, but how on earth do I get labels > to justify themselves left or right in a table? eg. I want this simple > effect: > > Label 1: [ entry field 1 ] > Long label 2: [ entry field 2 ] > > But try as I might the labels (and indeed entry fields) always centre > themselves. > > Also, how can I change the background colour of a label? Make it bold? It's all in the GtkLabel documentation : http://developer.gnome.org/doc/API/2.0/gtk/GtkLabel.html « gtk_label_set_justify() sets how the lines in a label align with one another. If you want to set how the label as a whole aligns in its available space, see gtk_misc_set_alignment(). » and : http://developer.gnome.org/doc/API/2.0/pango/PangoMarkupFormat.html So : ,---- | let () = | let w = GWindow.window () in | let b = GPack.vbox ~packing:w#add () in | GMisc.label | ~markup:"coucou" | ~xalign:1. | ~packing:b#pack () ; | GMisc.label ~text:"azertyuiopqsdfghjklm" ~packing:b#pack () ; | w#show () ; | w#connect#destroy GMain.quit ; | GMain.main () `---- In the next lablgtk release, the ocamldoc HTML documentation will have links to the GTK+ reference, so this kind of information will be easier to find/access. -- Olivier