piMinSize - DfBaseWindow

Determines the limit of the minimum size that a Component can be

Type: Property

Access: Read/Write

Data Type: Folded Integer

Parameters: None


piMinSize and piMaxSize have been added to the Component object (dbView, ModalPanel, etc) to limit the size to which the Component can be resized. Allowing the end-user to change the sizes of Components (dbView, ModalPanels, etc.) brings a new challenge: specifically, the temptation to see what happens when the Component is shrunk as small as it will go. There is to limit the minimum size that a Component can be. You achieve this by setting the piMinSize property.

When this property is set, two integer parameters are passed as specified in the parameter list. When the value of the property is retrieved, the value of these two properties is returned as a folded integer. The value of these parameters can be accessed using the hi() and low() functions.

Get piMinSize of oForm to iValue
Move (Hi(iValue)) to iHeight
Move (Low(iValue)) to iWidth

piMinSize is set as a single property passing the height and width as two separate parameters.

Set piMinSize of oForm to iHeight iWidth


In this example, the Component's minimum size will be the same as the size of the object, meaning that it can only get larger. If you wish, you can set it to be smaller, but test it to be certain that it cannot be shrunk to an unacceptable size.

Set Size To 100 250
Set piMinSize To 100 250

You can control the maximum size to which a Component can be resized by setting the piMaxSize property:

Set Size To 100 100
Set piMinSize To 50 50
Set piMaxSize To 200 600

A value of 0;0 means there is no minimum size.

Window Bounding and Client Area Sizing

The pbSizeToClientArea property in container objects allows for sizing to be based on a container's window bounding (outer) size or (inner) client area size. When True, client area sizing is used and sizing properties Size, GuiSize, piMinSize, and piMaxSize will apply to the window's client area. When False, these properties apply to the outer, non-client area.

Of Note

You need to ensure that you set the Component's Border_Style property to Border_Thick (which is not the default); otherwise, Windows will not let the end-user change the size of the Component.

Think carefully about how you want to set the anchors. It is entirely possible to set anchors in such a way that they will not logically work together. For example, if you have two Forms on the same row and you set them both to anchor left-and-right, they will overlap each other, as the Component gets wider (the first Form's right edge will go beyond the left-unmoving-edge of the second Form.). The solution would be to make one anchor left-and-right, but the other to be anchored left (if it was the first control) or right (if it was the second control). Alternatively, if you really want them both to get wider, then put them on different rows.

piMinSize and piMaxSize values can be set out range. They are out of range when the minimum size is greater than the initial size or when the maximum size is less than the initial size. When this occurs, it is a programming error and the object's behavior will be incorrect. Avoid this condition.