5. Functions
5.1. Common dialogs
5.1.1. hwg_SelectFont( [ oFont ] )
This function calls the standard dialog for font selecting.
- oFont - optional parameter, the current font object ( HFont instance ).
- Return value - the array with selected font characteristics ( nHandle, fontName, nWidth, nHeight ,fnWeight, fdwCharSet, fdwItalic, fdwUnderline, fdwStrikeOut )
or Nil, if the font wasn't selected.
Usually it isn't needed to call this function directly, use HFont():Select( oFont )
instead.
5.1.2. hwg_SelectFile( xDescript,xMask,[ cInitDir ], [ cTitle ] )
This function calls the standard dialog for file selecting.
- xDescript - this is a display string that describes the filter (for example, "dBase files")
or an array of such strings - in case if you need to have few file filters in a dialog box.
- xMask - this parameter combines into a pair with the xDescript,
it specifies the filter pattern (for example, "*.dbf"), which is described by the xDescript.
If you need to specify multiple filter patterns for a single display string,
use a semicolon to separate the patterns (for example, "*.bmp;*.jpg;*.png").
The xMask must be an array of filter patterns, if the xDescript is an array - and
must have the same length as the xDescript array.
- cInitDir - optional string parameter, the initial directory for file selecting.
- cTitle - optional string parameter, the title of a dialog box.
- Return value - a string with a selected file name, or an empty string, if a file wasn't selected.
5.1.3. hwg_SaveFile( cPrompt,cDescript,cMask,cInitDir,cTitle )
This function calls the standard dialog for file saving.
- cPrompt - this string appears as a prompt of a file name.
- cDescript - this string appears in the dialog as a description of a file type.
- cMask - string type parameter, describing the file mask.
- cInitDir - optional string parameter, the initial directory for file selecting.
- cTitle - optional string parameter, the title of a dialog box.
- Return value - a string with a selected file name, or an empty string, if a file wasn't selected.
5.1.4. hwg_PrintSetup( @cPrinterName )
This function calls the standard dialog for printer selecting.
- Return value ( numeric ) - handle to device context ( hDC ) of selected printer, 0 - if printer wasn't selected.
- Writes to the cPrinterName parameter the name of a selected printer.
5.1.5. hwg_ChooseColor( nColorCurrent )
This function calls the standard dialog for color selecting.
- nColorCurrent - a numeric parameter, initial value of a color,
- Return value ( numeric ) - selected color.
5.2. MessageBoxes and HwGUI dialogs
- 5.2.1. MsgInfo( cMessage,cTitle )
- 5.2.2. MsgStop( cMessage,cTitle )
- 5.2.3. MsgOkCancel( cMessage,cTitle )
- 5.2.4. MsgYesNo( cMessage,cTitle )
- 5.2.5. MsgBeep( nSound )
- 5.2.6. MsgGet( cTitle, cText, nStyle, x, y, nDlgStyle )
- 5.2.7. WChoice( arr, cTitle, nLeft, nTop, oFont, clrT, clrB, clrTSel, clrBSel, cOk, cCancel )
5.2.1. MsgInfo( cMessage,cTitle )
5.2.2. MsgStop( cMessage,cTitle )
5.2.3. MsgOkCancel( cMessage,cTitle )
5.2.4. MsgYesNo( cMessage,cTitle )
5.2.5. MsgBeep( nSound )
5.2.6. MsgGet( cTitle, cText, nStyle, x, y, nDlgStyle )
5.2.7. WChoice( arr, cTitle, nLeft, nTop, oFont, clrT, clrB, clrTSel, clrBSel, cOk, cCancel )
5.3. Drawing functions.
5.3.1. Overview
This is a set of functions, which is intended for drawing on a
window or control surface. There are few things I want to note before these
functions will be described:
- You can draw while WM_PAINT message processing only.
- You can draw on any kinds of windows/dialogs and on some kinds of controls:
panel, trackbar, owner button, splitter.
- All drawing functions demands the device context handle ( hDC ) to work,
so you need to get the hDC to start drawing.
5.4. Menu functions
- 5.4.1. CheckMenuItem( [oMenu|hWindow], nId, lCheck )
- 5.4.2. IsCheckedMenuItem( [oMenu|hWindow], nId )
- 5.4.3. EnableMenuItem( [oMenu|hWindow], nId|nPos, lEnable[, lId] )
- 5.4.3. IsEnabledMenuItem( [oMenu|hWindow], nId|nPos[, lId] )
- 5.4.5. SetMenuCaption( [oMenu|hWindow], nId, cCaption )
5.4.1. CheckMenuItem( [oMenu|hWindow], nId, lCheck )
Checks or unchecks a menu item.
- oMenu|hWindow - this parameter can be a menu object ( oMenu ), or a
handle of a window ( hWindow ), which owns the menu. If this parameter is omitted,
the main application menu is selected.
- nId - the ID number of a menu item.
- lCheck - a logical value, which shows, should the menu item be checked (.T.)
or unchecked (.F.).
5.4.2. IsCheckedMenuItem( [oMenu|hWindow], nId )
Returns .T. if the menu item is checked, and .F. in other case.
- oMenu|hWindow - this parameter can be a menu object ( oMenu ), or a
handle of a window ( hWindow ), which owns the menu. If this parameter is omitted,
the main application menu is selected.
- nId - the ID number of a menu item.
- Return value ( logical ) - .T. if the menu item is checked, and .F. in other case.
5.4.3. EnableMenuItem( [oMenu|hWindow], nId|nPos, lEnable[, lId] )
Enables or disables a menu item.
- oMenu|hWindow - this parameter can be a menu object ( oMenu ), or a
handle of a window ( hWindow ), which owns the menu. If this parameter is omitted,
the main application menu is selected.
- nId|nPos - the ID number ( nId ) of a menu item or a position ( nPos )
in the menu. Forth parameter lId determines how to interpret this parameter.
If the menu item is a submenu itself, i.e. it has nested menu items, you can't
refer to it by ID number, only the position can be used.
- lEnable - a logical value, which shows, should the menu item be enabled (.T.)
or disabled (.F.).
- lId - a logical value, which determines, is the second parameter
an ID number (.T.) or a position (.F.). The default value is .T., so, if this parameter
is omitted, the second parameter is interpreted as ID number.
If you enable/disable top level menu item, you need to call DrawMenuBar( hWindow ) function
( where hWindow is a handle of the window - menu owner ) to repaint the menu.
5.4.4. IsEnabledMenuItem( [oMenu|hWindow], nId|nPos[, lId] )
Returns .T. if the menu item is Enabled, and .F. in other case.
- oMenu|hWindow - this parameter can be a menu object ( oMenu ), or a
handle of a window ( hWindow ), which owns the menu. If this parameter is omitted,
the main application menu is selected.
- nId|nPos - the ID number ( nId ) of a menu item or a position ( nPos )
in the menu. Third parameter lId determines how to interpret this parameter.
- lId - a logical value, which determines, is the second parameter
an ID number (.T.) or a position (.F.). The default value is .T., so, if this parameter
is omitted, the second parameter is interpreted as ID number.
- Return value ( logical ) - .T. if the menu item is checked, and .F. in other case.
5.4.5. SetMenuCaption( [oMenu|hWindow], nId, cCaption )
Change a caption of a menu item.
- oMenu|hWindow - this parameter can be a menu object ( oMenu ), or a
handle of a window ( hWindow ), which owns the menu. If this parameter is omitted,
the main application menu is selected.
- nId - the ID number of a menu item.
- cCaption - string value, new menu item caption.