FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour TSay cuts the last character
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
TSay cuts the last character
Posted: Wed Jul 16, 2008 11:12 AM
Hi all,

under certain circumstances TSay cuts the last character.




I don´t use any font definitons. Does anyone ever noticed this ?
kind regards

Stefan
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: TSay cuts the last character
Posted: Wed Jul 16, 2008 11:14 AM

As a workaround, use SIZE clause.

EMG

Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
TSay cuts the last character
Posted: Thu Jul 17, 2008 07:54 AM
I found a solution, nWidth gets a wrong value by default in this line in the method ::New() in TSay

DEFAULT nWidth := SAY_CHARPIX_W * Len( ::cCaption ) - 4


If you replace it with

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 (...)

::nWidth := GetTextWidth( 0, ::cCaption, ::oFont:hFont)


Now also changed text is shown correctly.
kind regards

Stefan
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
TSay cuts the last character
Posted: Thu Jul 17, 2008 08:32 AM

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
Posts: 654
Joined: Fri Oct 21, 2005 05:54 AM
TSay cuts the last character
Posted: Fri Jul 18, 2008 01:50 AM

Hello Mr.Antonio

Where to add the changes in SAY.PRG

Thanks

  • Ramesh Babu P
Posts: 824
Joined: Thu Oct 13, 2005 07:39 AM
TSay cuts the last character
Posted: Fri Jul 18, 2008 07:27 AM
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
kind regards

Stefan

Continue the discussion