> All the apps support multiple languages via a different language
> header file, those strings and labels vary, therefore the apps
> have to calculate placement of text and other widgets on the
> window/dialog to account for longer words/sentences that wrap
> extra/etc.. using whatever font has been chosen as the default
> widget font.

You are right that the need to calculate the length of strings
arises often to build the GUI. I do like this:

Code common to all the GUI:
int labelSize = 12;
#define calc_width(str) \
 (fl_font(FL_HELVETICA, labelSize), (int)fl_width(str) + 4 * borderWidth)
#define add_button(label) \
        new Fl_Button(0,0,calc_width(label),25,label)

Code to create a button of the adequate width:
Fl_Widget *obj = add_button("Search:");
obj->labelsize(labelSize);

_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to