Symbol position

Symbol position

Postby Natter » Sat Jun 24, 2023 7:47 pm

There is a TSAY control :
Code: Select all  Expand view
@ 20,20 SAY oCl  PROMPT "Some text"  PIXEL  OF oDLG  SIZE 100, 20  FONT oFont

The text is pressed to the left. In this case, I can easily determine the starting position of any character.
For example, the 6th -"t"
Code: Select all  Expand view
GetTextWidth(NIL, left(oCl:GetText(),5), oFont:hFont)+1

However, if the text in TSAY is centered,
Code: Select all  Expand view
@ 20,20 SAY oCl  PROMPT "Some text"  PIXEL  OF oDLG  SIZE 100, 20  FONT oFont  CENTER

then the position of the symbol cannot be calculated in this way.
How can this be done ?
Natter
 
Posts: 1203
Joined: Mon May 14, 2007 9:49 am

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 52 guests