FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

WINDOWS

Control window size


Sorry for the ambiguous nature of the subject, I'm not listing pain-relievers for those unfortunate to work on another platform but passing on some stuff that I've found playing around with controlling windows.

I found that MINWINDOW didn't work as I thought once I had created a window, so plunging into ThinkRef I have come up with this: ( Be careful this will only work on windows with a zoom box - on other types of windows this record in the WndPtr& contains different information)
DIM wndPtr& 'pointer to the window on which you are working
            'you can use GET WINDOW to help you
DIM wndPeek&, theAdr&
DIM temp%

'   this is where the window record contains a pointer to the zoom info
'   as global coords
wndPeek& = [wndPtr&.wDataHandle&]
'   get the current top
temp% = wndPeek&.userState.top%
'   get the address to put the info back
theAdr& = @wndPeek&.userState.bottom%
'   poke back the info
'   minimumZoomHeight% is a value that you fix
'   heightChrome% is to take into account scrolls bars
'     and another stuff on the edges of the window
% theAdr&, ( temp% + minimumZoomHeight% + heightChrome%)
'   get the current left%
temp% = wndPeek&.userState.left%
'   get the address to put the info back
theAdr& = @wndPeek&.userState.right%
'   poke back the info
'   minimumZoomWidth% is a value that you fix
'   widthChrome% is to take into account scrolls bars
'     and another stuff on the edges of the window
% theAdr&, ( temp% + minimumZoomWidth% + widthChrome%)
And it's done!

if you use wndPeek&.stdState in place of wndPeek&.userState then you can fix the MAXWINDOW for zoom outs.

PS. this code is not very elegant - i'm sure that theAdr& and temp% are not needed, but it has the merit of being legible. if someone wants to optimise this code - go ahead.
Jonathan