FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour CLASS TWindow METHOD GetRect() BUG
Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
CLASS TWindow METHOD GetRect() BUG
Posted: Sun Jan 29, 2012 10:58 PM
Hi all,

Code (fw): Select all Collapse
MsgInfo(Len(oDlg:GetRect()))

return array with 5 elements and first is NIL
(that was not case in 16 bit version)

Code (fw): Select all Collapse
MsgInfo(Len(GetWndRect(oDlg:hWnd)))

return array with 4 elements and it is ok

Best regrads,
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 11:23 AM

GetRect() method returns an array of 4 items. Please look inside window.prg. Probably you are using a modified version of TWindow.

EMG

Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 01:11 PM
Hi Enrico,

I have not using a modified version of TWindow.
I have look inside window.prg and should be 4 items.
But try this sample please,

Code (fw): Select all Collapse
#include "FiveWin.ch"

function Main()

   local oDlg

   DEFINE DIALOG oDlg TITLE "Test"

   @  5, 5 BUTTON "&oDlg:GetRect()" OF oDlg SIZE 80, 12 PIXEL ;
           ACTION MsgInfo( LEN(oDlg:GetRect()) )

   @ 25, 5 BUTTON "&GetWndRect(oDlg:hWnd)" OF oDlg SIZE 80, 12 PIXEL ;
           ACTION MsgInfo( LEN(GetWndRect(oDlg:hWnd)) )

   ACTIVATE DIALOG oDlg CENTERED

return nil




Regards,
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 01:52 PM

Sorry, my fault. GetRect() method returns a TRect object not an array.

EMG

Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 06:49 PM
Yes Enrico,
But i have seen: Trect class and GetRect() method are identical in 16bit fivewin and 32 bit fwh
I use GetRect() years ago ... and it was ok.
This sample work well in 16 bit and produce error in 32 bit.
Code (fw): Select all Collapse
#include "FiveWin.ch"

//-------------
function Main()

   local oDlgMain

   DEFINE DIALOG oDlgMain FROM 0,0 to 200,200 PIXEL ;
          TITLE "Dialog 1"

   @  5, 5 BUTTON "&New Dialog" OF oDlgMain SIZE 80, 12 PIXEL ;
           ACTION NewDlg( oDlgMain )

   ACTIVATE DIALOG oDlgMain

return nil

//-----------------------
function NewDlg(oDlgMain)

   local oDlg
   local Coordinates := oDlgMain:GetRect()

   DEFINE DIALOG oDlg FROM Coordinates[1]+100,Coordinates[2]+100 ;
                      TO   Coordinates[3]+100,Coordinates[4]+100 ;
                      PIXEL ;
          TITLE "Dialog 2"

   ACTIVATE DIALOG oDlg

return nil




That mean i must change source of programs which still work on 16 bit fivewin?

Best regards
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 07:06 PM

What is exactly the problem? Your sample seems to work fine here.

EMG

Posts: 301
Joined: Fri Jun 01, 2007 09:07 AM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 07:15 PM

Application

Path and name: E:\FWH\samples\testrect.exe (32 bits)
Size: 1,550,848 bytes
Time from start: 0 hours 0 mins 2 secs
Error occurred at: 01/30/12, 20:08:24
Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = U
[ 2] = N 100

Stack Calls

Called from: testrect.prg => NEWDLG(27)
Called from: testrect.prg => (b)MAIN(12)
Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK(176)
Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT(1447)
Called from: .\source\classes\WINDOW.PRG => _FWH(3409)
Called from: => SENDMESSAGE(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND(407)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(933)
Called from: => DIALOGBOXINDIRECT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
Called from: testrect.prg => MAIN(14)

If i test:
MsgInfo(Len(oDlgMain:GetRect())) return 5
First item is NIL and items 2,3,4,5 are the values of coordinates.

Regards,

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 08:37 PM

As I said, it works fine here (FWH 11.11).

EMG

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: CLASS TWindow METHOD GetRect() BUG
Posted: Mon Jan 30, 2012 09:56 PM

Also works fine here with FWH 12.01 :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion