Hi All,
I would like to automatically center a button in a dialog box. I can`t find out how to do this. Is there a way it can be done ?
Regards,
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg
LOCAL oBtn
DEFINE DIALOG oDlg
@ 0, 0 BUTTON oBtn PROMPT "&Close";
ACTION oDlg:End()
ACTIVATE DIALOG oDlg;
ON INIT CENTERBTN( oDlg, oBtn );
CENTER
RETURN NIL
STATIC FUNCTION CENTERBTN( oDlg, oBtn )
LOCAL aDlgRect := GETCLIENTRECT( oDlg:hWnd )
LOCAL nDlgWidth := aDlgRect[ 4 ] - aDlgRect[ 2 ]
LOCAL nDlgHeight := aDlgRect[ 3 ] - aDlgRect[ 1 ]
LOCAL nRow := ( nDlgHeight - oBtn:nHeight() ) / 2
LOCAL nCol := ( nDlgWidth - oBtn:nWidth() ) / 2
oBtn:Move( nRow, nCol )
RETURN NIL
Return to FiveWin for CA-Clipper
Users browsing this forum: No registered users and 3 guests