Store and restore current window size

Two new frontcalls have been added in the standard frontcall library: storeSize and restoreSize.

  • storeSize asks GDC to store the current size of the current window.
  • restoreSize asks GDC to restore the stored size.

This allows you to create the classic GUI with Show/Hide details.

When show is clicked, the window grows to show more information. When hide is clicked, the window returns to its original size.
ON ACTION details
  IF state = 1 THEN
    CALL f.setElementHidden("g2",1)
    CALL f.setElementText("details","&Show details")
    CALL ui.interface.frontCall("standard","restoreSize",[200],[ret])
    LET state = 0
  ELSE
    CALL ui.interface.frontCall("standard","storeSize",[],[ret])
    CALL f.setElementHidden("g2",0)
    CALL f.setElementText("details","&Hide details")
    LET state = 1
  END IF

The restoreSize frontcall takes an optional parameter to define the delay (in milliseconds) used to revert the window size. The window will then smoothly shrink or grow to reach the saved size instead of having its new size immediately.

Calling restoreSize without calling storeSize, or on a different window, has no effect.

The stored size is a desired size; the layout has always higher priority. For instance, if the saved size is 800x600 and the content of the window is 1024x768, GDC will not be able to shrink to the expected size.