Hi all
The problem depends on whether the dialog is set to PIXEL or TRUEPIXEL,
in the case of pixels the problem is highlighted as you can try from the following test program.
I ask if Antonio can apply the changes back to the bottom of the tsay class test program.
Kind regards
Maurizio Menabue
Code: Select all | Expand
#include "FiveWin.ch"
Function Main
LOCAL oFont AS OBJECT
LOCAL oDlg AS OBJECT
LOCAL oSay AS OBJECT
oFont := tFont():new("Tahoma", 0, -12.00 ,,.F.,,,,.F.)
DEFINE DIALOG oDlg ;
SIZE 400,400 ;
TITLE "Test " + FWVERSION ;
PIXEL ;
FONT oFont
@ 20, 20 SAY oSay ;
VAR "Percentuale detraibilita' PIXEL" ;
OF oDlg ;
PIXEL ;
FONT oFont ;
COLOR CLR_HBLUE, CLR_YELLOW;
ADJUST
ACTIVATE DIALOG oDlg CENTER
DEFINE DIALOG oDlg ;
SIZE 400,400 ;
TITLE "Test " + FWVERSION ;
TRUEPIXEL ;
FONT oFont
@ 20, 20 SAY oSay ;
VAR "Percentuale detraibilita' TRUEPIXEL" ;
OF oDlg ;
PIXEL ;
FONT oFont ;
COLOR CLR_HBLUE, CLR_YELLOW;
ADJUST
ACTIVATE DIALOG oDlg CENTER
oFont:end()
return nil
*--------------------------------------
*- Piece of code in original class tSay
*--------------------------------------
*-100 DEFAULT nWidth := GetTextWidth( 0, ::cCaption, If( oFont != nil, oFont:hFont,;
*-101 If( oWnd:oFont != nil, oWnd:oFont:hFont,) ) )
*--------------------------------------
*- Piece of code in modified class tSay
*--------------------------------------
*-100 DEFAULT nWidth := (GetTextWidth( 0, ::cCaption, If( oFont != nil, oFont:hFont,;
*-101 If( oWnd:oFont != nil, oWnd:oFont:hFont,) ) ) ) / IF(oWnd:lTruePixel, 1, 2) <==============
*--------------------------------------
*- Piece of code in original class tSay
*--------------------------------------
*-351 if ! Empty( ::hWnd )
*-352 if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), nOr( SS_LEFT, SS_RIGHT, SS_CENTER ) ) .AND. ::lAdjust
*-353 nWidth = GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) ) + 20
*-354 if nWidth > ::nWidth
*-355 ::nWidth = nWidth
*-356 endif
*-357 endif
*-358 SetWindowText( ::hWnd, ::cCaption )
*-359 endif
*--------------------------------------
*- Piece of code in modified class tSay
*--------------------------------------
*-351 if ! Empty( ::hWnd )
*-352 if ! lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), nOr( SS_LEFT, SS_RIGHT, SS_CENTER ) ) .AND. ::lAdjust
*-353 nWidth := (GetTextWidth( 0, ::cCaption, If( ::oFont != nil, ::oFont:hFont,) ) + 20) / IF(::oWnd:lTruePixel, 1, 2) <==============
*-354 if nWidth > ::nWidth
*-355 ::nWidth = nWidth
*-356 endif
*-357 endif
*-358 SetWindowText( ::hWnd, ::cCaption )
*-359 endif