Block manual window resizing

Is there an easy way to prevent a form window from being manually resized?

I found a solution but I’m having a problem with it. I’m using the Form Properties | Window Size settings, and by making both the minimum and maximum the same, the window can not be resized. Great!

Window Size

The problem is that these minimum and maximum values are not updated if I use goform to move to a different size form.

For example, if I move to FORM-B and programmatically resize it to 200px by 200px, and then try to manually resize it, it will allow it, and will only resize it to 536px by 990px as defined in the previous form.

Note that FORM-B has it’s own settings set to 200px by 200px.

If I move into graphics mode and back, it updates the settings for that form as expected.

I was hoping for something simpler like:
setwindowoptions "RESIZE","NO"

You could put some code in the Form Event Procedure of the Form Options panel to force any resize attempt to snap back to the desired size. This code will snap the window back to your stated size.

formRESIZE:
    zoomwindow rtop(info("windowrectangle")),rleft(info("windowrectangle")),536,990
    return

Certainly not as elegant as restricting resizing all together, but functional at least.

Hi Gary, I forgot to mention that I looked at that option. The idea is more to prevent from showing hidden stuff in some of the forms, only accessible to the developer.

Unfortunately, the formRESIZE event would be executed after the form has been already resized. Thank you for looking into this.

Instead of using goform, perhaps your application could use a tab panel. The main tab panel window can be set to a fixed size, then each panel is automatically centered within the panel when you switch to it. However, this would not allow hidden information within a panel. Instead, you could set up a separate form for the hidden information, or separate panels that are not normally accessible. For example, Panorama’s site license window uses this technique - different panels are visible depending on whether or not you are logged in, and what your privilege level is. The Preferences and Database Options panels use the same technique.

Thank you Jim, Tab Panels is an option to consider for this purpose.

For the sounds of it, it seems that apple doesn’t provide you with an option to disable resizing of the window, do they?

One thing I would try is to force Panorama to gather the proper size resrictions by using successive goform commands.

goform "MyForm"
wait 0
goform "MyForm"

Maybe this will update the values - maybe not.

Unfortunately this didn’t work. The only way that I have found to force panorama to gather the new size restrictions is to go in and out of graphics.

For a long time I have used a custom statement that I named FIXWINDOW. Anytime it is called it will do its window sizing thing. I just tried it with Goform followed by fixwindow, and it seems to work. Here’s the code from my custom statement:

formxy 0,0

setwindowoptions "Toolbar",false()
if getformoption("","","MAXIMUMHEIGHT")=0 or      getformoption("","","MAXIMUMWIDTH")=0
    beep
    alertsheet "Max Height and/or Max Width are not set for this form."+cr()+cr()+"Form name: "+info("Formname")
    return
endif

zoomwindow 
    getformoption("","","WINDOWTOPEDGE"),
    getformoption("","","WINDOWLEFTEDGE"),
    getformoption("","","MAXIMUMHEIGHT")+24,
    getformoption("","","MAXIMUMWIDTH"), "notoolbars noscroll"

I have saved hours of dragging windows around with this statement.

Nah, this is just a garden variety bug. I’ve written it up.

I still think tab panels are a probably a better solution even once this bug is fixed.

I used Tom’s and Gary’s recommendation to create the following custom statement, which is called from the formRESIZE event:

if info("modifiers") notcontains "control"
  sizewindow_c parameter(1),parameter(2)
endif
formxy 0,0

Holding the Control key while resizing the forms works as an override.
The statement gets the width and height of the form as parameters, then I don’t have to deal with the form options settings.
sizewindow_c is my custom statement replacement for the unimplemented sizewindow from Pan6.

If data needs to remain hidden, I will use Jim’s recommendation with Tab Panels.
Thank you everyone for your input.

What does your sizewindow_c code do? Call zoomwindow or zoomwindowrectangle? I can’t think of any other way it could work. But if that’s what you’re doing, it’s not immediately obvious to me why that would work. But if you say it does, great.

It calls zoomwindow:

localparameters y,x
local left,top

left = rleft(info("windowrectangle"))
top = rtop(info("windowrectangle"))

zoomwindow top,left,y,x,info("windowoptions")

Ok, that’s what I figured. Looking at the zoomwindow code I don’t see why this fixes the max size issue, but apparently it does.