TSay cuts the last character

Post Reply
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

TSay cuts the last character

Post by StefanHaupt »

Hi all,

under certain circumstances TSay cuts the last character.


Image

I don´t use any font definitons. Does anyone ever noticed this ?
kind regards
Stefan
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

I found a solution, nWidth gets a wrong value by default in this line in the method ::New() in TSay

Code: Select all

DEFAULT nWidth := SAY_CHARPIX_W * Len( ::cCaption ) - 4
If you replace it with

Code: Select all

DEFAULT nWidth := GetTextWidth( 0, ::cCaption, IIF (oFont != nil, oFont:hFont, oWnd:oFont:hFont ) )
all is working fine.

In method ::SetText you have to do the same, insert this line before ::SetWindowText (...)

Code: Select all

::nWidth := GetTextWidth( 0, ::cCaption, ::oFont:hFont)
Now also changed text is shown correctly.
kind regards
Stefan
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Stefan,

We have modified it as per your advise, many thanks :-)

A little modifications in your code:
DEFAULT nWidth := GetTextWidth( 0, ::cCaption, If( oFont != nil, oFont:hFont,;
If( oWnd:oFont != nil, oWnd:oFont:hFont,) ) )

::nWidth := GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
RAMESHBABU
Posts: 591
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Post by RAMESHBABU »

Hello Mr.Antonio

Where to add the changes in SAY.PRG

Thanks

- Ramesh Babu P
StefanHaupt
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Post by StefanHaupt »

Antonio Linares wrote:Stefan,

We have modified it as per your advise, many thanks :-)
My pleasure :D

Ramesh,
the first change is in method ::new() and the second in method ::SetText(). See also my former post
kind regards
Stefan
Post Reply