GetRect() difference

GetRect() difference

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: GetRect() difference

Postby Antonio Linares » Wed Jul 13, 2016 6:03 pm

Marc,

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: GetRect() difference

Postby Marc Vanzegbroeck » Wed Jul 13, 2016 8:51 pm

Antonio,

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

Code: Select all  Expand view

.....
.....
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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: GetRect() difference

Postby Antonio Linares » Fri Jul 15, 2016 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: GetRect() difference

Postby Marc Vanzegbroeck » Fri Jul 15, 2016 7: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: GetRect() difference

Postby Marc Vanzegbroeck » 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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: GetRect() difference

Postby Marc Vanzegbroeck » Fri Aug 19, 2016 1: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
Marc Vanzegbroeck
 
Posts: 1159
Joined: Mon Oct 17, 2005 5:41 am
Location: Belgium

Re: GetRect() difference

Postby Antonio Linares » Fri Aug 19, 2016 4:40 pm

very good
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42093
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 117 guests