André,
how to use :
LOCAL
aRect[4]@ 200, 280 BUTTON "&Message" OF oDlg1 SIZE 45, 13 PIXEL ;
ACTION MYMSGBOX(
.T., aRect, "There is an error and the process could not be completed."+CRLF+"Please try it once again.",,"Error Message",,,aGradiate1,,,,oIcon1)
// save the Dialog-zize to a Array
ACTIVATE DIALOG oDlg1 ;
ON INIT ( oDlg1:Move( 50, 30, , , .f. ), ;
aRect[1] := oDlg1:nTop, aRect[2] := oDlg1:nLeft, ;
aRect[3] := oDlg1:nHeight, aRect[4] := oDlg1:nWidth )
Changes in Ramesh's function :// lPosition = .T. means < calculated >
FUNCTION MyMsgBox(
lPosition, aRect, cMsg, aOptions, cTitle, xIcon, nDefault, aGradiate, ;
bAction, oFont, cFileRes, oIcon, uVar, cPict, bValid,;
lSpinner, lMeter, oMeter, lCancel)
...
...
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT (DlgInit(oDlg,
lPosition, aRect, oFont, cMsg, aOptions, cTitle, nDefault,;
aGradiate, bAction, xIcon, @uVar, cPict, bValid,;
lSpinner, lMeter, oMeter, @lCancel),;
gradiate(oDlg, aGradiate))
STATIC FUNCTION DlgInit(oDlg,
lPosition, aRect, oFont, cMsg, aOptions, cTitle, nDefault,;
aGradiate, bAction, xIcon, uVar, cPict, bValid,;
lSpinner, lMeter, oMeter, lCancel )
...
...
// calculate the center-position
IF
lPosition = .T. oDlg:Move( aRect[1] + ( aRect[3] / 2 ) - ( nMaxHeight / 2 ), ;
aRect[2] + ( aRect[4] / 2 ) - ( nMaxWidth / 2 ), , , .f. )ELSE
// centered on Main-window
WndCenter(oDlg:hWnd)
ENDIF
Best Regards
Uwe