[futurebasic] Re: [FB] GrowWindow

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1998 : Group Archive : Group : All Groups

From: Robert Purves <robert.purves@...>
Date: Tue, 22 Dec 1998 16:36:16 +1300
At 2:59 PM +1300 22/12/98, Sylvain Guillemette wrote:
>wndSize& = FN GROWWINDOW (wndPtr&,point,limitRect)
>I'm trying to get the width and the height of the
>window returned in wndSize&.
>wndSize&: lo=width,hi=height
>What is lo and hi ???

At 4:12 PM +1300 22/12/98, Mark Goodes wrote:
>To get the values, do something like this:
>height={wndSize&}
>width={wndSize&+2}
>where the 2 states that we want to look at the value which begins two bytes
>past the point where the long word value starts.

No, that doesn't work.  wndSize& is a variable, not a pointer.

Two 2-byte integers are packed into a LONG. The example below shows how to
unpack them:-

WINDOW 1
DIM limitrect.8
DIM aPt.4
PRINT "Drag mouse"
DO: UNTIL FN BUTTON
CALL GETMOUSE(aPt)
wndPtr&=WINDOW(_wndPointer)
CALL SETRECT(limitRect,10,10,600,500)
wndSize& = FN GROWWINDOW (wndPtr&,aPt,limitRect)
PRINT "Width=" wndSize& AND &FFFF ' low 2 bytes of wndSize&
PRINT "Height=" wndSize& >> 16 ' shifted hi 2 bytes
DO: UNTIL FN BUTTON=0
DO: UNTIL FN BUTTON


>BTW: Is it possible to scan all the open windows and get
>their names and their wndPtr& ?

Yes; here's how:-

WINDOW 1
WINDOW 2, "Test"
WINDOW 200
FOR j=1 TO 255' search the FB window record
 windowPtr&=[WNDBLK +j*16]
 LONG IF windowPtr&<>_nil
  PRINT " Window " j " exists: ";
  CALL GETWTITLE(windowPtr&, title$)
  PRINT title$
 END IF
NEXT j
DO: UNTIL FN BUTTON

Robert Purves