Page 1 of 1
TSay cuts the last character
Posted: Wed Jul 16, 2008 11:12 am
by StefanHaupt
Hi all,
under certain circumstances TSay cuts the last character.
I donĀ“t use any font definitons. Does anyone ever noticed this ?
Re: TSay cuts the last character
Posted: Wed Jul 16, 2008 11:14 am
by Enrico Maria Giordano
As a workaround, use SIZE clause.
EMG
Posted: Thu Jul 17, 2008 7:54 am
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.
Posted: Thu Jul 17, 2008 8:32 am
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,) )
Posted: Fri Jul 18, 2008 1:50 am
by RAMESHBABU
Hello Mr.Antonio
Where to add the changes in SAY.PRG
Thanks
- Ramesh Babu P
Posted: Fri Jul 18, 2008 7:27 am
by StefanHaupt
Antonio Linares wrote:Stefan,
We have modified it as per your advise, many thanks
My pleasure
Ramesh,
the first change is in method ::new() and the second in method ::SetText(). See also my former post