[futurebasic] Re: Zoom Window without scrollbars...

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

From: Brian Victor <bhv11@...>
Date: Tue, 26 May 1998 19:07:00 -0400
>>>How do I build a normal window, with a close box, zoom box, no scroll bars
>>>and no "resize" block at the bottom right?
>>
>>I think this what you're looking for:
>>
>>_myZoomNoGrow   = 13
>>
>>Use that constant for the window type (in place of _docNoGrow, etc.)
>Is it possible to build a window WITHOUT scroll bars but WITH the "resize"
>block at the bottom right?

This will take a little more code, included below.  This is trimmed from a
program I am working on.  The basic things that happen are that
DRAWGROWICON is called following a refresh event.  (FN doDialog)  Since
FB's runtime doesn't automatically handle this type of window resizing, in
order to resize the window, we call FN resizeConsoleWindow when the mouse
is clicked in the bottom-right 16 pixels of the window, and let the toolbox
handle the rest.

In FN resizeConsoleWindow, the call to SETRECT determines the minimum and
maximum rectangles to which the user is allowed to resize the window.  As
the code currently is, the minimum window size is 64 by 64 and the maximum
is the screen's width by the screen's height less 40.  That's probably not
the best option, especially if the user has multiple monitors.

Also, now that I look at it, sizePtr& doesn't seem to be a pointer.  If you
modify this code, be sure not to get confused by that.

And lastly, there are two lines (one in resizeConsoleWindow and one in
doMouse) that got wrapped by the net.  Make sure you merge those separate
lines into one before you compile.

Hope this helps.

-- Brian Victor



LOCAL
DIM clickPt.4,theRect.8,wndPtr&,sizePtr&
LOCAL FN resizeConsoleWindow(wNum%)
  clickPt.h% = MOUSE(_lastMHorz)
  clickPt.v% = MOUSE(_lastMVert)
  CALL LOCALTOGLOBAL(clickPt)
  CALL SETRECT(theRect,64,64,SYSTEM(_scrnWidth),SYSTEM(_scrnHeight)-40)
  GET WINDOW #wNum%,wndPtr&
  sizePtr& = FN GROWWINDOW(wndPtr&,clickPt,theRect)
  LONG IF {@sizePtr&}>0
    REM Mailer wrapped next 2 lines
    WINDOW #wNum%,,(-WINDOW(_toLeft),-WINDOW(_toTop))-(-WINDOW(_toLeft)+
      {@sizePtr&+2},-WINDOW(_toTop)+{@sizePtr&})
    FN rebuildConsoleWindow(wNum%)
  END IF
END FN

LOCAL
DIM dlg%,id%,wndPtr%
LOCAL FN doDialog
  dlg%=DIALOG(0)
  id%=DIALOG(dlg%)
  SELECT dlg%
    CASE _wndRefresh
      WINDOW OUTPUT id%
      SELECT WINDOW(_outputWClass)
        CASE _consoleClass               ' Substitute your window class here
          GET WINDOW #id%,wndPtr&
          CALL DRAWGROWICON(wndPtr&)
      END SELECT
  END SELECT
END FN

LOCAL
DIM evnt%
LOCAL FN doMouse
  evnt%=MOUSE(0)
  SELECT WINDOW(_activeWClass)
    CASE _consoleClass                   ' again, your window class here
      SELECT evnt%
        CASE _click1ndrag
          REM mailer wrapped next three lines
          IF MOUSE(_lastMHorz)>WINDOW(_width)-16 AND
             MOUSE(_lastMVert)>WINDOW(_height)-16 THEN FN
             resizeConsoleWindow(WINDOW(_activeWnd))
      END SELECT
  END SELECT
END FN

ON DIALOG FN doDialog
ON MOUSE  FN doMouse