Hi all,

Now the problem is clear and the solution found. Thanks to all .

According Fred's advice  onPaint is avoided.

I tried  baseform.onfocusedwidgetchanged( newwidget .......)

It works only when  newwidget object  is  a Mse*Object ?

I mean

  If (newwidget is myownobject )  return false then
     I can not adjust the  caption

  see :   
https://www.mail-archive.com/[email protected]/msg12722.html

so the only solution is oncreate form which is not so  smart.

Regards

Med.


________________________________
De : Sieghard <[email protected]>
Envoyé : mercredi 7 août 2019 22:53
À : [email protected] 
<[email protected]>
Objet : Re: [MSEide-MSEgui-talk] Fonts

Hello mohamed,

you wrote on Tue, 6 Aug 2019 16:35:58 +0000:

>    Suppose you have a simplewidget   with bound_x=490,  If you want to
> fill it's frame.caption with  '-'  the number of chars must be   125 then
> the width of char is  490/125=3,92  wich is not the width of the font?

That's because you probabely use a proportional font, where all the
characters have their individual width and font.width returns that of a
"representative" character, often an "m". If you used a monospaced font,
the font.width would be the same for all characters, although, of course,
it looks different.
But maybe you can make use of one of the "textrect" functions of the
"msedrawtext" unit, which generally take a canvas object as their first
parameter (implicitely specifying the font to check) and several other
parameters, often a string to be evaluated. They return a "rectty" record,
where the "cx" field contains the width value you are looking for.
You probabely will have to select the appropriate version of the function
according to your needs; the unit is located in the "mse.common/graphics"
directory, the file name is "msedrawtext.pas".

--
--
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------




_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
_______________________________________________
mseide-msegui-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to