SAY pixel position
Posted: Mon Feb 13, 2006 1:17 pm
Using PIXEL with TSay, the position given is not the real position in the dialog.
If I set @ 5,45 PIXEL ..... the real position is 10,90.
So, if want the pixel-position 5,45 on the dialog, I must use 2.5 , 22.5
why?
Code: Select all
#include "FplFwh.Ch"
*******************
FUNCTION Test4711()
*******************
LOCAL oDlg, oSay, cText := "Hallo"
DEFINE DIALOG oDlg FROM 0,0 TO 50,200 PIXEL TITLE "Test"
@ 5, 45 SAY oSay VAR cText OF oDlg PIXEL
oDlg:bStart := {||CheckPosition(oDlg,oSay:nId),oDlg:End()}
ACTIVATE DIALOG oDlg CENTER
RETURN NIL
***************************************
STATIC FUNCTION CheckPosition(oDlg,nId)
***************************************
LOCAL aPos := Le_GetIdPos(oDlg,nId)
nMsgBox(STR(aPos[1])+CHR(13)+;
STR(aPos[2])+CHR(13)+;
STR(aPos[3])+CHR(13)+;
STR(aPos[4])+CHR(13))
RETURN NIL
******************************
FUNCTION Le_GetIdPos(oWnd,nId)
******************************
LOCAL aRect, aWinRect, nLeftDiff, nRightDiff, hWndParent
hWndParent := oWnd:hWnd
aRect := GetClientRect(GetDlgItem(hWndParent,nID))
aWinRect := GetClientRect(hWndparent)
nLeftDiff := aWinRect[3] - aRect[3]
nRightDiff := aWinRect[4] - aRect[4]
aWinRect := GetWndRect(GetDlgItem(hWndParent,nID))
aWinRect[3] := aWinRect[3] - aWinRect[1]
aWinRect[4] := aWinRect[4] - aWinRect[2]
ScreenToClient(hWndParent,@aWinRect)
RETURN aWinRect
So, if want the pixel-position 5,45 on the dialog, I must use 2.5 , 22.5
why?