GuiToDialog - DfBaseWindow
This is used to convert gui units to dialog units.
Type: Function
Return Data Type: Integer
Parameters
| Parameter | Type | Description |
|---|---|---|
| iHeight | integer | Gui height to be converted to dialog units |
| iWidth | Integer | Gui width to be converted to dialog units |
Syntax
Function GuiToDialog integer iHeight Integer iWidth Returns Integer
Call Example
Get GuiToDialog iHeight iWidth to IntegerVariable
Description
GuiToDialog is used to convert gui units to dialog units. This is passed a gui height and a gui width and it returns a folded value representing those values in dialog units. The Hi value represents the height, the Low value represents the width.
This function returns a folded integer value.
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.
This can be used to convert client and window gui units to dialog units.
// this finds the client size of an object in dialog units
Get GuiClientSize of oView to iGuiSize
Move (Hi(iGuiSize)) to iGuiY
Move (Low(iGuiSize)) to iGuiX
Get GuiToDialog of oView iGuiY iGuiX to iSize
Move (Hi(iSize)) to iDialogY
Move (Low(iSize)) to iDialogX
For example, this code can be used to place an editor within a view with a exact two dialog margin around it. This will work with any view with any style border or caption bar.
// Assume this code is within the view
// pass the child edit object to size and locate
Procedure SizeAndLocateEditor handle hoEdit
Integer iSize iGuiSize iX iY
Get GuiClientSize to iGuiSize
Move (Hi(iGuiSize)) to iY
Move (Low(iGuiSize)) to iX
Get GuiToDialog iY iX to iSize
Move (Hi(iSize)) to iY // this is the Y dialog unit
Move (Low(iSize)) to iX // this is the X dialog unit
Set Size of hoEdit to (iY-4) (iX-4)
Set Location of hoEdit to 2 2
End_Procedure
See Also
DialogToGui | GuiClientSize | GuiWindowSize
Return Value
A folded value, representing the height (hi) and width (low) in dialog units