On 02/04/12 00:31, testalucida wrote: > I tried that before and I could swear width always being 0. > But as I wrote this I tried again (on Linux) and it worked. > Perhaps it was on Windows? I'll try on Monday.
I'm guessing in the tests where you got 0, fl_font() hadn't been set just before calling fl_measure(). When a program starts up, unless fl_font() is called, the current font will be unset and therefore unknown. So if fl_measure() is called without a font set, it will likely return 0. (The behavior is undefined). I'm guessing this is why your first call to fl_measure() would return 0, and subsequent calls returned valid values. This is likely because on program startup, before any widgets have been drawn, no font is set. Then, when one or more widgets have actually drawn themselves (which end up calling fl_font()), then a valid current font has been set, remaining in effect until your subsequent calls to fl_measure(). By setting fl_font() just before calling fl_measure(), you're now getting fl_measure() to respond reliably, because its not using a random value for the current font. _______________________________________________ fltk mailing list fltk@easysw.com http://lists.easysw.com/mailman/listinfo/fltk