- Code: Select all Expand view
#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
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?