James,
it is just a guess. To properly calculate a dimension we need to use +1.
If +1 is not needed then somewhere there is a wrong code...
/*
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
aRect:= saveRestore()
nTop:= aRect[1]
nLeft:= aRect[2]
// test only. Trying adding +1
nWidth:= aRect[4] - aRect[2] +1
nHeight:= aRect[3] - aRect[1] +1
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
In conformance with conventions for the RECT structure, the bottom-right coordinates of the returned rectangle are exclusive. In other words, the pixel at (right, bottom) lies immediately outside the rectangle.
Antonio Linares wrote:So do we need to modify something in FWH regarding this ?
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 79 guests