GetSmallestSize subroutine
' ***** GetSmallestSize *****
SUB GetSmallestSize
  XuiSendMessage (grid, #GetBorder, 0, 0, 0, 0, XuiDialog2B, @bw)
  XuiSendMessage (grid, #GetSmallestSize, 0, 0, @labelWidth, @labelHeight, $Label, 8)
  XuiSendMessage (grid, #GetSmallestSize, 0, 0, @textWidth, @textHeight, $TextLine, 8)
  FOR i = $Button0 TO $Button1
    XuiSendMessage (grid, #GetSmallestSize, 0, 0, @width, @height, i, 8)
    IF (width > buttonWidth) THEN buttonWidth = width
    IF (height > buttonHeight) THEN buttonHeight = height
  NEXT i
  width = buttonWidth + buttonWidth
  IF (width < labelWidth) THEN width = labelWidth
  v2 = width + bw + bw
  v3 = labelHeight + textHeight + buttonHeight + bw + bw

A GetSmallestSize subroutine is needed in any resizable grid.  Grid functions generated by GuiDesigner are not resizable - they are initially set up to return the fixed design size when they receive a #GetSmallestSize message.

The GetSmallestSize and Resize subroutines in this function are a good model, since most grid functions employ the similar methods.

GetSmallestSize first sends a #GetBorder message to itself get its own border width.   Next it sends #GetSmallestSize messages to its kids - the XuiLabel at the top, the XuiTextLine below it, and the two XuiPushButtons at the bottom.  It sets the smaller of the buttons equal the larger, sets the overall width v2 to the largest width plus twice the border width, and sets the overall height v3 to the sum of the label height, text height, button height, and twice the border width.