[futurebasic] re: Re: [FB] [FB II] Moving Controls (here's that code, ian)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2001 : Group Archive : Group : All Groups

From: tedd <tedd@...>
Date: Wed, 7 Nov 2001 08:20:55 -0500
-bb:

It resizes for me...

However, what is displayed is not what you want.

tedd

---

>ian-
>
>here's the code that "almost" works.
>
>but grab the extreme lower-right corner of the grow-box,
>and you'll see that it moves the window instead of resizing it.
>
>because as far as the o.s. is concerned, you've grabbed the frame,
>as it doesn't know that you've placed a grow-box there on your own...
>
>-bowerbird
>
>
>'   here's sample code for a hand-rolled grow box on a _docnogrow window.
>'
>'   since i was at it, i put in an additional grow box at the lower left,
>'   as well as two "jumper" spots at the upper corners.  try them out...
>'
>'   it doesn't draw the outline when it extends outside to the desktop,
>'   but overall, it seems to work well enough for my purposes.  enjoy.
>'   let me know if you see any problems with it.      -bowerbird@...
>
>COMPILE 0,_caseinsensitive : WINDOW OFF
>gb=16 : REM size of grow box squares...
>gminwide=100 : gminhigh=100 : REM minimum window-size
>END GLOBALS
>GOTO "main"
>
>CLEAR LOCAL FN doend
>   END
>END FN
>
>CLEAR LOCAL FN drawgrowbox
>   oldOut=WINDOW(_outputWnd)
>   WINDOW OUTPUT(WINDOW(_activewnd))
>   b=WINDOW(_height)
>   r=WINDOW(_width)
>   t=b-16 : l=r-16
>   grwRgn&=FN NEWRGN
>   CALL RECTRGN(grwRgn&,t)
>   saveCurClipRgn&=FN NEWRGN
>   CALL GETCLIP(saveCurClipRgn&)
>   CALL SETCLIP(grwRgn&)
>   CALL DRAWGROWICON(WINDOW(_wndPointer))
>   CALL SETCLIP(saveCurClipRgn&)
>   CALL DISPOSERGN(grwRgn&)
>   CALL DISPOSERGN(saveCurClipRgn&)
>   IF oldOut THEN WINDOW OUTPUT(oldOut)
>END FN
>
>CLEAR LOCAL FN dorefresh
>   wnd=WINDOW(_activewnd)
>   WINDOW OUTPUT(wnd)
>   CALL SIZEWINDOW(WINDOW(_wndPointer),w,h,_true)
>   WINDOW OUTPUT(wnd) : REM so fb updates data-structures for this window
>   WINDOW wnd : WINDOW FILL
>END FN
>
>CLEAR LOCAL FN resizewnd(wnd,w,h)
>   LONG IF (wnd>0) AND WINDOW(-wnd) : REM make sure the window exists
>     WINDOW OUTPUT(wnd)
>     CALL SIZEWINDOW(WINDOW(_wndPointer),w,h,_true)
>     WINDOW OUTPUT(wnd) : REM so fb updates data-structures for this window
>     WINDOW wnd : WINDOW FILL
>   END IF
>END FN
>
>CLEAR LOCAL FN makewindow (left,top,right,bottom)
>   IF right-left<gminwide THEN right=left+gminwide'  min width
>   IF bottom-top<gminhigh THEN bottom=top+gminhigh'  min height
>   IF WINDOW(-1)<>0 THEN WINDOW CLOSE 1
>   WINDOW 1,"home grown...",(left,top)-(right,bottom),_docnogrow
>   EDIT FIELD -1,"hello there, space friend...",(20,20)-(100,100),_framed
>   SETSELECT 0,0 : EDIT FIELD 0
>   WINDOW FILL : CLS : FN drawgrowbox
>END FN
>
>CLEAR LOCAL FN handlegrowboxes
>   horiginal=MOUSE(_lastmhorz)
>   voriginal=MOUSE(_lastmvert)
>   left=(-WINDOW(_toleft))
>   top=(-WINDOW(_totop))
>   right=left+WINDOW(_width)-1
>   bottom=top+WINDOW(_height)-1
>   DO
>     what=MOUSE(0) : h=MOUSE(_horz) : v=MOUSE(_vert)
>     IF horiginal>gb THEN right=left+h : bottom=top+v
>     IF horiginal<=gb THEN left=left+h : bottom=top+v
>     IF right<left THEN SWAP right,left
>     IF bottom<top THEN SWAP bottom,top
>     LONG IF h<>lh OR v<>lv
>       FN resizewnd (1,right-left,bottom-top)
>       WINDOW FILL : CLS : FN dorefresh : REM no FN drawgrowbox
>     END IF
>     lh=h : lv=v
>   UNTIL FN BUTTON=_false
>   CALL PENNORMAL
>   IF horiginal>gb THEN right=left+h : bottom=top+v
>   IF horiginal<=gb THEN left=left+h : bottom=top+v
>   IF right<left THEN SWAP right,left
>   IF bottom<top THEN SWAP bottom,top
>   FN resizewnd (1,right-left,bottom-top)
>   WINDOW FILL : CLS : FN dorefresh : FN drawgrowbox
>END FN
>
>CLEAR LOCAL FN domouse
>   what=MOUSE(0)
>   horiginal=MOUSE(_lastMHorz)
>   voriginal=MOUSE(_lastMVert)
>   LONG IF voriginal<=gb
>     LONG IF horiginal<=gb
>       left=0 : right=left+WINDOW(_width)-1
>       top=40 : bottom=top+WINDOW(_height)-1
>       FN makewindow (left,top,right,bottom) : REM jumps to upper-left corner
>     END IF
>   END IF
>   LONG IF voriginal<=gb
>     LONG IF horiginal>=WINDOW(_width)-gb
>       left=SYSTEM(_scrnwidth)-WINDOW(_width)+1 : right=SYSTEM(_scrnwidth)
>       top=40 : bottom=WINDOW(_height)+40-1
>       FN makewindow (left,top,right,bottom) : REM jumps to upper-right corner
>     END IF
>   END IF
>   LONG IF voriginal>=WINDOW(_height)-gb
>     LONG IF horiginal<=gb OR horiginal>=WINDOW(_width)-gb
>       IF horiginal<=gb THEN BEEP : EXIT FN
>       FN handlegrowboxes
>     END IF
>   END IF
>END FN
>
>CLEAR LOCAL FN dodialog
>   evnt=DIALOG(0) : id=DIALOG(evnt)
>   LONG IF evnt=_wndrefresh
>     WINDOW FILL : CLS : FN dorefresh : FN drawgrowbox
>   END IF
>END FN
>
>"main"
>MENU 1,0,1,"file" : MENU 1,1,1,"quit /q"
>FN makewindow (40,40,400,200)
>ON MOUSE FN domouse
>ON DIALOG FN dodialog
>ON MENU FN doend
>DO
>   HANDLEEVENTS
>UNTIL 0
>
>
>--
>To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>


-- 
http://sperling.com