- Code: Select all Expand view
- METHOD cToChar( cCtrlClass ) CLASS TControl
local n := GetDlgBaseUnits()
DEFAULT cCtrlClass := ::ClassName(),;
::cCaption := "",;
::nId := ::GetNewId(),;
::nStyle := nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP )
return cCtrl2Chr( Int( 2 * 8 * ::nTop / nHiWord( n ) ),;
Int( 2 * 4 * ::nLeft / nLoWord( n ) ),;
Int( 2 * 8 * ::nBottom / nHiWord( n ) ),;
Int( 2 * 4 * ::nRight / nLoWord( n ) ),;
::nId, ::nStyle, cCtrlClass, ::cCaption )
Esos "2" no son necesarios y esa es la razón por la que las dimensiones de los pixeles no son respetadas.
Le estoy muy agradecido a Paco por su gran ayuda al descubrir este bug que lleva desde el inicio de FiveWin.
Ahora tenemos que decidir que hacer. Hemos de mantener compatibilidad hacia atras, así que él me propuso una nueva claúsula:
In dialog.ch
- Code: Select all Expand view
- #xcommand DEFINE DIALOG <oDlg> ;
[ <resource: NAME, RESNAME, RESOURCE> <cResName> ] ;
[ TITLE <cTitle> ] ;
[ FROM <nTop>, <nLeft> TO <nBottom>, <nRight> ] ;
[ SIZE <nWidth>, <nHeight> ] ;
[ <lib: LIBRARY, DLL> <hResources> ] ;
[ <vbx: VBX> ] ;
[ STYLE <nStyle> ] ;
[ <color: COLOR, COLORS> <nClrText> [,<nClrBack> ] ] ;
[ BRUSH <oBrush> ] ;
[ <of: WINDOW, DIALOG, OF> <oWnd> ] ;
[ <pixel: PIXEL> ] ;
[ ICON <oIco> ] ;
[ FONT <oFont> ] ;
[ <help: HELP, HELPID> <nHelpId> ] ;
[ <transparent: TRANSPARENT> ] ;
[ GRADIENT <aGradColors> ] ;
[ <lTruePixel: TRUEPIXEL> ] ;
=> ;
<oDlg> = TDialog():New( <nTop>, <nLeft>, <nBottom>, <nRight>,;
<cTitle>, <cResName>, <hResources>, <.vbx.>, <nStyle>,;
<nClrText>, <nClrBack>, <oBrush>, <oWnd>, <.pixel.>,;
<oIco>, <oFont>, <nHelpId>, <nWidth>, <nHeight>, <.transparent.>,;
<aGradColors>, <.lTruePixel.> )
y en dialog.prg
- Code: Select all Expand view
- Dialog.prg
DATA lTruePixel AS LOGICAL INIT .F.
METHOD New( nTop, nLeft, nBottom, nRight, cCaption, cResName, hResources,;
lVbx, nStyle, nClrText, nClrBack, oBrush, oWnd, lPixels,;
oIco, oFont, nHelpId, nWidth, nHeight, lTransparent, aNewGradColors, lTruePixel ) CONSTRUCTOR
METHOD New( nTop, nLeft, nBottom, nRight, cCaption, cResName, hResources,;
lVbx, nStyle, nClrText, nClrBack, oBrush, oWnd, lPixels,;
oIco, oFont, nHelpId, nWidth, nHeight, lTransparent, aNewGradColors, lTruePixel ) CLASS TDialog
DEFAULT hResources := GetResources(), lVbx := .f.,;
nClrText := GetSysColor( COLOR_BTNTEXT ), nClrBack := GetSysColor( COLOR_BTNFACE ),;
lPixels := .f., nTop := 0, nLeft := 0, nBottom := 10, nRight := 40,;
nWidth := 0, nHeight := 0, lTransparent := .f.,;
nStyle := nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION, WS_SYSMENU ),;
lTruePixel := .f.
::lTruePixel = lTruePixel
In control.prg
- Code: Select all Expand view
METHOD cToChar( cCtrlClass ) CLASS TControl
local n := GetDlgBaseUnits()
DEFAULT cCtrlClass := ::ClassName(),;
::cCaption := "",;
::nId := ::GetNewId(),;
::nStyle := nOR( WS_CHILD, WS_VISIBLE, WS_TABSTOP )
return cCtrl2Chr( Int( if(::oWnd:lTruePixel,1,2) * 8 * ::nTop / nHiWord( n ) ),;
Int( if(::oWnd:lTruePixel,1,2) * 4 * ::nLeft / nLoWord( n ) ),;
Int( if(::oWnd:lTruePixel,1,2) * 8 * ::nBottom / nHiWord( n ) ),;
Int( if(::oWnd:lTruePixel,1,2) * 4 * ::nRight / nLoWord( n ) ),;
::nId, ::nStyle, cCtrlClass, ::cCaption )
me gustaría conocer vuestras opiniones antes de proceder a implementarlo, gracias