/*
Purpose : Test showing how to save/restore dialog location
Author : James Bott, jbott@compuserve.com
Date : 12/3/2014 2:09:38 PM
Language: Fivewin/xHarbour
Notes : Drag the dialog to a new position, then close it, then press the button
and the dialog will be restored in the last position.
The location is saved using the VALID clause and restored using oDlg:Move()
The location is saved in memory here, but you could use a file to restore
it.
*/
#include "fivewin.ch"
static aCoord
Function main()
local oWnd, oBar, oBtn
aCoord := {100,100,300,500}
define window oWnd
define buttonbar oBar of oWnd
define button oBtn of oBar action MakeDlg(saveRestore())
activate window oWnd maximized on init makeDlg()
return nil
Function MakeDlg(aRect)
local oDlg
Local nTop,nLeft,nWidth,nHeight
define dialog oDlg of wndMain()
aRect:= saveRestore()
nTop:= aRect[1]
nLeft:= aRect[2]
nWidth:= aRect[4] - aRect[2]
nHeight:= aRect[3] - aRect[1]
activate dialog oDlg centered ;
VALID ( saveRestore(getWndRect(oDlg:hWnd)), .t.);
ON INIT oDlg:move(nTop, nLeft, nWidth+1, nHeight+1, .t.)
return nil
function saveRestore(aRect)
if aRect != nil
aCoord := aclone(aRect)
endif
return aCoord
// eof
/*_____________________________________________________________________________*/
/*_____________________________________________________________________________*/
/*___ OZScript ________________________________________________________________*/
METHOD GetWinCoors() CLASS TApplication
LOCAL oIni
LOCAL nRow, nCol, nWidth, nHeight, nState
nRow := VAL(GetPvProfString("Config", "nTop", "10", ::cIniFile))
nCol := VAL(GetPvProfString("Config", "nLeft", "10", ::cIniFile))
nWidth := VAL(GetPvProfString("Config", "nRight", "800", ::cIniFile))
nHeight := VAL(GetPvProfString("Config", "nBottom", "600", ::cIniFile))
nState := VAL(GetPvProfString("Config", "Mode", nState, ::cIniFile))
IF nRow == 0 .AND. nCol == 0
WndCenter(::oWndMain:hWnd)
ELSE
::oWndMain:Move(nRow, nCol, nWidth, nHeight)
ENDIF
IF nState == ST_ICONIZED
::oWndMain:Minimize()
ELSEIF nState == ST_ZOOMED
::oWndMain:Maximize()
ENDIF
UpdateWindow( ::oWndMain:hWnd )
::oWndMain:CoorsUpdate()
SysRefresh()
RETURN NIL
METHOD SetWinCoors() CLASS TApplication
LOCAL oIni
LOCAL nRow, nCol, nWidth, nHeight, nState
::oWndMain:CoorsUpdate()
nRow := ::oWndMain:nTop
nCol := ::oWndMain:nLeft
nWidth := ::oWndMain:nRight-::oWndMain:nLeft
nHeight := ::oWndMain:nBottom-::oWndMain:nTop
IF IsIconic( ::oWndMain:hWnd )
nState := ST_ICONIZED
ELSEIF IsZoomed(::oWndMain:hWnd)
nState := ST_ZOOMED
ELSE
nState := ST_NORMAL
ENDIF
WritePProString("Config","nTop",Ltrim(Str(nrow)),::cIniFile)
WritePProString("Config","nLeft",Ltrim(Str(ncol)),::cIniFile)
WritePProString("Config","nRight",Ltrim(Str(nwidth)),::cIniFile)
WritePProString("Config","nBottom",Ltrim(Str(nheight)),::cIniFile)
WritePProString("Config","Mode",Ltrim(Str(nstate)),::cIniFile)
DbCloseAll()
ResAllFree()
* ::oImgList:End()
RETURN .t.
/*
Purpose : Test showing how to save/restore dialog location
Author : James Bott, jbott@compuserve.com
Date : 12/3/2014 2:09:38 PM
Language: Fivewin/xHarbour
Notes : Drag the dialog to a new position, then close it, then press the button
and the dialog will be restored in the last position.
The location is saved using the VALID clause and restored using oDlg:Move()
The location is saved in memory here, but you could use a file to restore
it.
*/
#include "fivewin.ch"
static aCoord
Function main()
local oWnd, oBar, oBtn
aCoord := {100,100,300,500}
define window oWnd
define buttonbar oBar of oWnd
define button oBtn of oBar action MakeDlg(saveRestore())
activate window oWnd maximized on init makeDlg()
return nil
Function MakeDlg(aRect)
local oDlg
Local nTop,nLeft,nWidth,nHeight
define dialog oDlg of wndMain()
@ 2,4 BUTTON "Get Width/Height" ;
ACTION ;
msgInfo( cValToChar(getWndRect(oDlg:hWnd)[3]-getWndRect(oDlg:hWnd)[1] ) +"/"+;
cValToChar(getWndRect(oDlg:hWnd)[4]-getWndRect(oDlg:hWnd)[2]) ) ;
size 100,15
activate dialog oDlg centered ;
VALID ( saveRestore(getWndRect(oDlg:hWnd)), .t.);
ON INIT oDlg:move(nTop, nLeft, nWidth, nHeight, .t.)
return nil
function saveRestore(aRect)
if aRect != nil
aCoord := aclone(aRect)
endif
return aCoord
// eof
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 68 guests