Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note: If the control was hidden, applying the SIZE property makes it visible, except when setting the 5th field to -1.

See also

CLIENTSIZE propertySend_Message COLWIDTHMAXIMIZESIZE propertyTRACKINGSIZE property

Example

Code Block
subroutine PlaceDialog(xPos, yPos)
 
* this subroutine places a dialog on the screen using the
* same information that Popup uses to determine its
* placement;
* xPos and yPos are passed in as:
*   -2     - center of screen
*   -1     - center of window
*   other  - offset to window
*
* assumes @window is the dialog id, which is true if this is
* called from an event, like the CREATE event, of a dialog
 
declare function   Get_Property
declare subroutine Set_Property
 
ScreenSize = Get_Property("SYSTEM", "SIZE")
DialogSize = Get_Property(@window, "SIZE")
Parent     = Get_Property(@window, "PARENT")
ParentSize = Get_Property(Parent, "SIZE")
 
wScreen    = ScreenSize<3>   ;* width of screen
hScreen    = ScreenSize<4>   ;* height of screen
xDialog    = DialogSize<1>   ;* position of dialog
yDialog    = DialogSize<2>   ;* position of dialog
wDialog    = DialogSize<3>   ;* width of dialog
hDialog    = DialogSize<4>   ;* height of dialog
xParent    = ParentSize<1>   ;* position of parent
yParent    = ParentSize<2>   ;* position of parent
wParent    = ParentSize<3>   ;* width of parent
hParent    = ParentSize<4>   ;* height of parent
 
* calculate position for the dialog begin case
  * center w.r.t. screen
  case xPos = -2 or yPos = -2
    xDialog = (wScreen - wDialog) / 2
    yDialog = (hScreen - hDialog) / 2
  * center w.r.t. parent
  case xPos = -1 or yPos = -1
    xDialog = xParent + (wParent - wDialog) / 2
    yDialog = yParent + (hParent - hDialog) / 2
  * position w.r.t. parent
  case 1
    xDialog = xParent + xPos
    yDialog = yParent + yPos
end case
 
* make sure that the dialog is on the screen
if xDialog < 0                 then xDialog = 0
if yDialog < 0                 then yDialog = 0
if xDialog + wDialog > wScreen then xDialog = wScreen -
Dialog
if yDialog + hDialog > hScreen then yDialog = hScreen - hDialog
  NewSize = xDialog: @fm: yDialog: @fm: wDialog: @fm: hDialog
  Set_Property(@window, "SIZE", NewSize) 
return