On Wed, 2004-01-28 at 02:51, Clint Jeffery wrote:
> Steve,
> 
> Regarding font sizes, as you know they depend on what font you've selected,
> and you can't have selected a font until you have a window open.  However,
> if you know what font you are going to use, you can always open a "hidden"
> offscreen window, select your font into it, and then calculate exact widths
> of arbitrary strings using TextWidth() or whatever; the widths will be
> correct if the same font is later selected into a visible window on the same
> display.

Thanks!  - That's cleaner than the hack I finally ended up using.

> With a _Dialog, there may be an issue of figuring out what font it is going
> to use; there is a default font in the GUI classes, and there is a list of
> attributes to apply to _Dialogs and to individual components within the
> dialogs; you may have to chain through a number of components (from
> innermost to enclosing ones) to find the font=... value that would apply
> for the component you are wishing to measure.

Ah, so I've discovered (the version of YesNoDialog.icn in the unilib
cvs respository attempts to allow you to change the font size of the
message area)...   The code there 'sorta' works - you can change the
font with a (new) setFont(font) method call, but the size calculation
doesn't use that new font yet, but rather the 'default' font for
the Dialog.

Part of the problem is that knowing the font doesn't seem to be enough,
as TextWidth() requires a window.  [It would be nice if TextWidth()
would also accept a font (as in, say:

    width := TextWidth("sans,24",mesg)

then all my troubles (ok, a few of them, anyway) would go away!]

Thanks, Clint - you've given me helpful information!

-- 
Steve Wampler -- [EMAIL PROTECTED]
The gods that smiled on your birth are now laughing out loud.


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Unicon-group mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to