Re: Graphical User Interface

From: Ilka Antcheva <Ilka.Antcheva_at_cern.ch>
Date: Tue, 09 Jan 2007 12:09:13 +0100


Hi Tom,
> I am trying to build a GUI. Unfortunately the documents are sparse, as
> are examples.

The descriptions of GUI classes will be improved soon and will take place in ROOT Reference Guide on the web.
>
>
> The TGComboBox and TGListBox do not have sensible default sizes.
> Unfortunately, the only example using them, guitest.C, contains
> HARD-CODED sizes for them -- a very bad idea.
There is a freedom given by different ways to include these widgets in the GUI:
- You can create a parent frame with kFixedWidth option and without specifying the width, you can use kLHintsExpandX layout hint in AddFrame method. This way the widget will be resized up to the size of parent frame after the amount of left/right/top/bottom padding is taken into account.
- You can use the Resize method, as it is done in guitest.C
> How can I set reasonable default sizes for my widgets?
It is very specific and related with the GUI design. You could use the way described in point one above.
> How can I determine how many pixels an "M" is, wide and tall, for the
> default font of these widgets?

Use the method TextWidth of TVirtualX that returns length of the given string in pixels according to the used font: Int_t textWidth = gVirtualX->TextWidth(fFontStruct, my_string , my_string_length);

Cheers, Ilka Received on Tue Jan 09 2007 - 12:11:58 CET

This archive was generated by hypermail 2.2.0 : Tue Jan 09 2007 - 17:50:00 CET