TSay cuts the last character

TSay cuts the last character

Postby StefanHaupt » Wed Jul 16, 2008 11:12 am

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

Re: TSay cuts the last character

Postby Enrico Maria Giordano » Wed Jul 16, 2008 11:14 am

As a workaround, use SIZE clause.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby StefanHaupt » Thu Jul 17, 2008 7:54 am

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

Code: Select all  Expand view
DEFAULT nWidth := SAY_CHARPIX_W * Len( ::cCaption ) - 4


If you replace it with

Code: Select all  Expand view
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  Expand view
::nWidth := GetTextWidth( 0, ::cCaption, ::oFont:hFont)


Now also changed text is shown correctly.
kind regards
Stefan
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany

Postby Antonio Linares » Thu Jul 17, 2008 8: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby RAMESHBABU » Fri Jul 18, 2008 1:50 am

Hello Mr.Antonio

Where to add the changes in SAY.PRG

Thanks

- Ramesh Babu P
User avatar
RAMESHBABU
 
Posts: 624
Joined: Fri Oct 21, 2005 5:54 am
Location: Secunderabad (T.S), India

Postby StefanHaupt » Fri Jul 18, 2008 7:27 am

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
StefanHaupt
 
Posts: 824
Joined: Thu Oct 13, 2005 7:39 am
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 68 guests