FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour GetRect() difference
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

GetRect() difference

Posted: Wed Jul 13, 2016 10:41 AM

Hi,

In my program with FWH32 7.10, oWnd:GetRect()[3] returns -8
in the new program with FWH64 16.04 Revd Build3 it is returning 1048.

Is there a difference between the version 7.10 & 16.04 or is there a difference between the 32bit and the 64bit version?
What is the correct one?

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: GetRect() difference

Posted: Wed Jul 13, 2016 06:03 PM

Marc,

Could you post an example of how you are using it ? thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

Re: GetRect() difference

Posted: Wed Jul 13, 2016 08:51 PM
Antonio,

I'm using it to autosize a dialog, and move it into the middle of the main window (oMenuWnd).

Code (fw): Select all Collapse
.....
.....
ACTIVATE DIALOG oDlg CENTERED valid mbrowseexit() on init msize(oDlg,svGetlist,vWBreedte)
.....
RETURN

FUNCTION msize(oDlg,svGetlist,vWBreedte)
   local vhoogte   := oMenuWnd:nHeight - oDlg:nHeight - 8 -48
   vwbreedte = min(vwbreedte,oMenuWnd:nWidth-60) 
   ........
   oDlg:nWidth  = vWBreedte + 68
   oDlg:move(oMenuWnd:nTop+4+24+oMenuWnd:GetRect()[2],(oMenuWnd:nWidth/2)-((vWBreedte+68)/2)+oMenuWnd:GetRect()[3])
   ........
RETURN


Perhaps there is an easyer way to center, and resize the dialog.
vwbreedte is the width op the dialog. Then there is cheched if it is not to wide...
Then the dialog is centered....
Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: GetRect() difference

Posted: Fri Jul 15, 2016 06:19 AM

Marc,

You can center a dialog (or any window or control) doing:

oDlg:Center()

to change the size fo a dialog (or any window or control) you can do:

oDlg:SetSize( nWidth, nHeight )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

Re: GetRect() difference

Posted: Fri Jul 15, 2016 07:26 AM

Thank you Antonio,

I was using this code since FW1.95, and never changed it because it was working fine :)

oDlg:Center() and oDlg:SetSize( nWidth, nHeight ) is working fine with FWH64 16.04 Rev Build3 :wink:

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

Re: GetRect() difference

Posted: Fri Aug 19, 2016 12:48 PM

Antonio,

This problem was solved with your solution, but now i found that I also use it in my programs, to know the location of the mail window, when closing the program.

I saved nPos[2] and nPos[3] of oMenuWnd:GetRect() to know the location, but now it is not OK anymore.
How can I get the location of the window, so I can restore it again while opening it?

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 1195
Joined: Mon Oct 17, 2005 05:41 AM

Re: GetRect() difference

Posted: Fri Aug 19, 2016 01:12 PM

Problem solved. :D :D
Now I use nPos:nTop and nPos:nLeft, and it's working in the old FW and the new one.
I found that when using the array nPos, position 5 is nil in the old version, and not in the new version.
In the new version nPos[4] is equal to nPos[5] of the old version, and so on...

Regards,

Marc



FWH32+xHarbour | FWH64+Harbour | BCC | DBF | ADO+MySQL | ADO+MariaDB | ADO+SQLite
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: GetRect() difference

Posted: Fri Aug 19, 2016 04:40 PM

very good

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion