How to stop a window from being resized below a minimum size (OnResize SETPOSITION does not work)

Applies to: posted in the Clarion 6 group; an MDI application with a frame and maximized child windows. The thread does not name the template chain.

Problem

The poster wanted a window never to go below a given size. His OnResize embed read the position and set it back:

GETPOSITION(0,X#,Y#,W#,H#)
SETPOSITION(0,X#,Y#,CHOOSE(W# < 471, 471, W#), CHOOSE(H# < 241, 241, H#))

It had no effect. Setting PROP:MinWidth and PROP:MinHeight right after opening the window did not work either.

Solution

  1. Use the window properties, not GET and SET calls: PROP:MinWidth and PROP:MinHeight for a lower limit (PROP:MaxWidth and PROP:MaxHeight for an upper one).
  2. When the child window is maximized inside an MDI frame, set the properties on the frame, because the frame is what the user resizes.
  3. To reach the frame from any procedure, declare a global reference gAppFrameRef &WINDOW, assign it after the frame opens (gAppFrameRef &= AppFrame), and then use gAppFrameRef{PROP:MinWidth} and gAppFrameRef{PROP:MinHeight}.
  4. Another poster set the same properties in the EVENT:OpenWindow case, on the frame or on the form window (AppFrame{PROP:MinWidth} = width).

Caveats

  • The poster said he would build on the global reference; he did not report the final result.
  • The thread gives no way to compute the right values from the child window; the values are the ones you choose.
  • One reply first suggested the MAX properties by mistake and corrected it to MIN.

Today (2026)

Likely unchanged, since these are window properties of the language. Not re-tested.

Sources: Modest A. (Mar 2008, the question), Lee W. (Mar 2008), Paul H., Nicholas P. (Mar 2008) in softvelocity.public.clarion6.