If I click on Dialog Button Activate the dialog.
If I start with default values the dialog is positioned in
100 , 200 , 640 , 818 instead of 100 , 200 , 600 , 800
If I close dialog and click again the button I have 100 , 200 , 680 , 836
Every time the dialog is 40 pixel and 18 pixel more big than previus click
How can I calculate this differences in order to save in a .ini files the exact coords?
King regards
marco
- Code: Select all Expand view
- #include "fivewin.ch"
REQUEST HB_GT_GUI_DEFAULT
#define crlf CHR(13)+CHR(10)
FUNCTION Main()
LOCAL oMain
LOCAL oBut1, oBut2
LOCAL oTop , nTop := 100
LOCAL oLeft , nLeft := 200
LOCAL oBottom , nBottom := 600
LOCAL oRight , nRight := 800
DEFINE WINDOW oMain
// @ 1 , 1 BUTTON oBut1 PROMPT "Dialog" ACTION ( Dialogo( oTop, oLeft, oBottom, oRight ) , ;
// segna( oMain, oTop, oLeft, oBottom , oRight ) ) SIZE 100 , 30
@ 1 , 1 BUTTON oBut1 PROMPT "Dialog" ACTION Dialogo( oTop, oLeft, oBottom, oRight ) size 100 , 30
@ 1 , 90 BUTTON oBut2 PROMPT "Reset" ACTION ( nTop := 100 , nLeft := 100 , nBottom := 600 , nRight := 800 , ;
oTop:refresh() , oLeft:refresh() , oBottom:refresh() ,oRight:refresh() ) SIZE 100 , 30
@ 1 , 20 GET oTop VAR nTop OF oMain SIZE 50 , 20
@ 1 , 30 GET oLeft VAR nLeft OF oMain SIZE 50 , 20
@ 1 , 40 GET oBottom VAR nBottom OF oMain SIZE 50 , 20
@ 1 , 50 GET oRight VAR nRight OF oMain SIZE 50 , 20
ACTIVATE WINDOW oMain MAXIMIZED
RETURN NIL
FUNCTION DIALOGO( oTop, oLeft, oBottom, oRight )
LOCAL oDlg
DEFINE DIALOG oDlg FROM oTop:varget() , oLeft:varget() TO oBottom:varget() , oRight:varget() PIXEL ;
STYLE nOr( WS_CAPTION, WS_THICKFRAME, WS_SYSMENU, WS_MINIMIZEBOX, WS_MAXIMIZEBOX )
oDlg:bResized = { || ( oDlg:CoorsUpdate() , aggiorna( oDlg, oTop, oLeft, oBottom , oRight ) ) }
oDlg:bMoved := {|| oDlg:CoorsUpdate() , aggiorna( oDlg, oTop , oLeft, oBottom , oRight ) }
ACTIVATE DIALOG oDLg ON INIT oDlg:move( oTop:varget() , oLeft:varget() , oRight:varget() - oLeft:varget() , oBottom:varget() - oTop:varget() )
RETURN NIL
FUNCTION AGGIORNA( oDlg, oTop , oLeft, oBottom , oRight )
oTop:varput( oDlg:nTop )
oLeft:varput( oDlg:nLeft )
oBottom:varput( oDlg:nBottom )
oRight:varput( oDlg:nRight )
oTop:refresh()
oLeft:refresh()
oBottom:refresh()
oRight:refresh()
RETURN NIL