Hi all,
in order to rightly dimension the controls, I need to determine the default font size at program start.
I noticed that in a test machine using font sized at 125% buttons and other controls were badly sized with text inside truncated and, worst of all, some editboxes were just not editable.
After digging in sources I found the function HMG_getAverageFontSize and now, finally, i get for one machine 7 x 16 and for the other one 9 x 20
Here is the function executed ON INIT:
function my_setfontsize()
local nFontWidth, nFontHeight, lNoErr
local wh:=getFormHandle("mainwindow")
lNoErr=HMG_getAverageFontSize(wh,@nFontWidth,@nFontHeight)
if lNoErr
msgInfo("System default font size:"+str(nFontWidth)+"x"+str(nFontHeight))
else
msgInfo("An error occurred")
endif
return nil
It costed me a fair amount of time, digging in this forum first and in sources then. (And a lot of trials and errors ...)
I wonder if there is a simpler way
Good programming to all!
Dan
determine system default font size
Moderator: Rathinagiri
- serge_girard
- Posts: 3167
- Joined: Sun Nov 25, 2012 2:44 pm
- DBs Used: 1 MySQL - MariaDB
2 DBF - Location: Belgium
- Contact:
Re: determine system default font size
Thanks Dan for this useful function!
Serge
Serge
There's nothing you can do that can't be done...