Sunteți pe pagina 1din 30

Alexander Kresin Rus Eng

software
HwGUI 2.21 reference manual
prev Alexander S.Kresin, October 2018 next

5. Functions

• 5.1. Common dialogs


• 5.2. MessageBoxes and HwGUI dialogs
• 5.3. Drawing functions.
• 5.4. Windows handling functions.
• 5.5. Controls handling functions.
• 5.6. Menu functions.
• 5.7. Windows registry.
• 5.8. Miscellaneous functions.
• 5.A. Functions, not included in documentation

5.1. Common dialogs

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.

hwg_SelectFile( cDescript,cMask,[ cInitDir ], [ cTitle ] )


This function calls the standard dialog for file selecting.

• cDescript - this string appears in the dialog as a description


of a file type. In Windows version this parameter may be an
array of descriptions ({ "All files", "Dbf files"});
• cMask - string type parameter, describing the file mask
("*.dbf", for example). In Windows version this parameter may be
an array of masks ({ "*.*", "*.dbf"}); The length of this array
must be the same as of cDescript;
• 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.

An example:
cFileName := hwg_Selectfile( {"dbf files( *.dbf )","All
files(*.*)"}, ;
{"*.dbf","*.*"}, cPath )

hwg_SelectFileEx( [cTitle] [,cInitDir] [,aDescript] ) (GTK


only)
Another standard dialog for file selection.

• cTitle - optional string parameter, the title of a dialog box.


• cInitDir - optional string parameter, the initial directory for
file selecting.
• aDescript - an array like { { "Dbf files", "*.dbf" }, { "All
files", "*" } } with file masks and descriptions;
• Return value - a string with a selected file name, or an empty
string, if a file wasn't selected.

An example:
cFileName := hwg_SelectFileEx( ,, { { "Dbf files", "*.dbf"
}, { "All files", "*" } } )

hwg_SelectFolder( cTitle )
The standard dialog for folder selection.

• cTitle - optional string parameter, the title of a dialog box.


• Return value - a string with a selected folder name, or an empty
string, if a folder wasn't selected.

hwg_SaveFile( cPrompt,cDescript,cMask,cInitDir,cTitle )
(Windows only)
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.

An example:
fname := hwg_Savefile( "*.htm","( *.htm )","*.htm", cPath )

hwg_PrintSetup( @cPrinterName ) (Windows only)


This function calls the standard dialog for printer selecting.
• Return value - handle to device context ( hDC ) of selected
printer, 0 - if a printer wasn't selected.
• Writes to the cPrinterName parameter the name of a selected
printer.

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, Nil - if a color
wasn't selected.

5.2. MessageBoxes and HwGUI dialogs


hwg_MsgInfo( cMessage,cTitle )
hwg_MsgStop( cMessage,cTitle )
hwg_MsgOkCancel( cMessage,cTitle )
hwg_MsgYesNo( cMessage,cTitle )
hwg_MsgYesNoCancel( cMessage,cTitle )
hwg_MsgNoYes( cMessage,cTitle ) (Windows only)
hwg_MsgRetryCancel( cMessage,cTitle ) (Windows only)
hwg_Exclamation( cMessage,cTitle )
These all are standard message boxes with a different buttons
set.

• cMessage - a message text;


• cTitle - a title of a box;
• Return value ( logical ) - for those of them, which has more
than one button.

hwg_MsgBeep( nSound ) (Windows only)

hwg_ShellAbout( cText1, cText2 [,hIcon] ) (Windows only)

hwg_MsgGet( cTitle, cText, nStyle, nLeft, nTop, nDlgStyle,


cInitStr )
Creates a dialog box to input a string.

• cTitle - a title of a box;


• cText - a prompt for the input;
• nStyle - a WinAPI style for a GET item (ES_PASSWORD, for
example);
• nLeft, nTop - coordinates of the left upper corner of a dialog
box;
• nDlgStyle - a WinAPI style for a dialog;
• cInitStr - init value of a string;
• Return value ( string ) - the string, which you entered, empty -
if you press CANCEL.

hwg_WChoice( arr, cTitle, nLeft, nTop, oFont, clrT, clrB,


clrTSel, clrBSel, cOk, cCancel )
Creates a dialog box to select from a list.

• arr - an array, one-dimensional or multidimensional, which


represents the list;
• cTitle - a header of a dialog box;
• nLeft, nTop - dialog box left upper corner coordinates;
• oFont - a font for a dialog, an object of HFont class;
• clrT, clrB - colors ( text and background ) of a browse;
• clrTSel, clrBSel - colors ( text and background ) of a selected
row of a browse;
• cOk - a caption of a button to confirm selecting. If this
parameter is omitted, the button will not present;
• cCancel - a caption of a button to cancel selecting. If this
parameter is omitted, the button will not present;
• Return value - the number of selected row, 0 - if nothing is
selected.

5.3. Drawing functions.


hwg_DefinePaintStru()

• Return value - a pointer to a paint structure.

It is called during the painting (usually it is a Paint() method),


together with two next functions, hwg_BeginPaint( handle, pps ) and
hwg_EndPaint( handle, pps ).

hwg_BeginPaint( handle, pps )


This function starts painting.

• handle - handle of a painted object;


• pps - a pointer to a paint structure;
• Return value - handle of a device context (hDC).

hwg_EndPaint( handle, pps )


This function ends painting.

• handle - handle of a painted object;


• pps - a pointer to a paint structure.

hwg_Getdrawiteminfo( lpDis ) (Windows only)


If a control has SS_OWNERDRAW style and messages for him aren't
handled by HwGUI (look at 3.9. Inside HwGUI), the handler of ON PAINT gets
as a second parameter a pointer to DRAWITEMSTRUCT WinAPI structure,
which contains an information, needed to draw this control. A function
hwg_GetDrawItemInfo( lpDis ) extracts this info and returns to a
programmer as an array.
While drawing these controls functions hwg_DefinePaintStru(),
hwg_BeginPaint(), hwg_EndPaint() shouldn't be used.

• lpDis - a pointer to DRAWITEMSTRUCT;


• Return value - an array aDrawItem with an information about
widget being painted;
aDrawItem[3] - hDC;
aDrawItem[4] - nLeft, left border of drawing area;
aDrawItem[5] - nTop, top border of drawing area;
aDrawItem[6] - nRight, right border of drawing area;
aDrawItem[7] - nBottom, bottom border of drawing area;

hwg_GetClientRect( handle )

• handle - handle of a control;


• Return value - an array aArea with a control client area
coordinates;
aArea[1] - nLeft, left border of client area;
aArea[2] - nTop, top border of client area;
aArea[3] - nRight, right border of client area;
aArea[4] - nBottom, bottom border of client area;

hwg_SelectObject( hDC, handle )


This function selects an object of HFont, HPen or HBrush class as
current for drawing area, i.e., all subsequent drawing operations will
use it.

• hDC - handle of the device context;


• handle - a variable handle of an object of HFont, HPen or HBrush
class.

For example:
// Create HPen object: a line thickness - 2px, a color -
red
oPen := HPen():Add( BS_SOLID, 2, 255 )
// Select this object as current for hDC
hwg_Selectobject( hDC, oPen:handle )
// Draw a 2px red line
hwg_Drawline( hDC, 5, 1, 100, 1 )

hwg_DeleteObject( handle )
Deletes a font, a pen, a brush, a bitmap or an icon. Pay attention
that this function works on WinAPI/GTK level, it deletes not a HwGUI
object, but WinaPI/GTK's. Ususlly it isn't needed to call it directly
from your application, the Release() method of an appropriate HwGUI
class does all necessary operations.

• handle - a variable handle of an object of HFont, HPen, HBrush,


HBitmap or HIcon class.

hwg_MoveTo( hDC, x1, y1 )


Changes current position of a pen on a drawing area.

• hDC - handle of the device context;


• x1, y1 - point coordinates.
hwg_LineTo( hDC, x1, y1 )
Draws a line from a current position to a point with given
coordinates. Uses a pen, selected with the help of hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - point coordinates.

hwg_Rectangle( hDC, x1, y1, x2, y2 )


Draws a rectangle with given coordinates. Uses a pen, selected with
the help of hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates.

hwg_Box( hDC, x1, y1, x2, y2 ) (Windows only)


Draws a rectangle with given coordinates and fills area inside. Uses a
pen and a brush, selected with the help of hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates.

hwg_DrawLine( hDC, x1, y1, x2, y2 )


Draws a line from one point to another. Uses a pen, selected with the
help of hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - first point coordinates.
• x2, y2 - second point coordinates.

hwg_Pie( hDC, x1, y1, x2, y2, xr1, yr1, xr2, yr2 ) (Windows
only)
Draws a pie-shaped wedge bounded by the intersection of an ellipse and
two radials and fills area inside. Uses a pen and a brush, selected
with the help of hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates of a bounding rectangle;
• x2, y2 - right bottom corner coordinates of a bounding
rectangle;
• xr1, yr1 - coordinates of the endpoint of the first radial;
• xr2, yr2 - coordinates of the endpoint of the second radial.

hwg_Ellipse( hDC, x1, y1, x2, y2 )


Draws an ellipse in a rectangle with given coordinates and fills area
inside. Uses a pen and a brush, selected with the help of
hwg_SelectObject().
• hDC - handle of the device context;
• x1, y1 - left top corner coordinates of a bounding rectangle;
• x2, y2 - right bottom corner coordinates of a bounding
rectangle;

hwg_FillRect( hDC, x1, y1, x2, y2, hBrush )


Fills a rectangle with given coordinates, using a passed brush.

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates;
• hBrush - a handle of a brush ( may be oBrush:handle ).

hwg_RoundRect( hDC, x1, y1, x2, y2, xRad, yRad )


Draws a rectangle with rounded corners. Uses a pen, selected with the
help of hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates;
• xRad, yRad - width and height of an ellipse used to draw rounded
corners.

hwg_Drawbutton( hDC, x1, y1, x2, y2, nFlag )


Draws a button.

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates;
• nFlag - determines, how to draw a button:
1 - normal;
2 - pressed;
5 - flat;
6 - flat pressed.

hwg_DrawEdge( hDC, x1, y1, x2, y2, nFlag, nBorder ) (Windows


only)
Draws one or more edges of rectangle.

• hDC - handle of the device context;


• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates;
• nFlag - the type of inner and outer edges, it is a combination
of one inner-border flag and one outer-border flag. For details
look at the MSDN documentation for DrawEdge() function.
• nBorder - the type of border, For details look at the MSDN
documentation for DrawEdge() function.

hwg_gtk_DrawEdge( hDC, x1, y1, x2, y2, nFlag ) (GTK only)


Draws one or more edges of rectangle.
• hDC - handle of the device context;
• x1, y1 - left top corner coordinates;
• x2, y2 - right bottom corner coordinates;
• nFlag - determines, how to draw.

hwg_drawGradient( hDC, x1, y1, x2, y2, int type, array


colors, array stops, array radiuses )
This function draws rectangle with rounded corners and fill it with
gradient pattern.

• hDC - handle of device context;


• x1 and y1 - coordinates of upper left corner;
• x2 and y2 - coordinates of bottom right corner;
• type - the type of gradient filling:
1 - vertical and down;
2 - vertical and up;
3 - horizontal and to the right;
4 - horizontal and to the left;
5 - diagonal right-up;
6 - diagonal left-down;
7 - diagonal right-down;
8 - diagonal left-up;
9 - radial gradient;
• colors - our colors (maximum - 16 colors), a color can be
represented as 0xBBGGRR;
• stops - fractions on interval [0;1] that correspond to the
colors, a stop determines the position where the corresponding
color reaches its maximum;
• radiuses - for our rounded corners:
first - for upper left;
second - for upper right;
third - for bottom right;
fourth - for bottom left;

hwg_OpenImage( cName | cBody [, lMem] )


Create a bitmap from the data stored in an image file or in a passed
data. In most cases you don't need to call this function directly, use
HBitmap():AddFile(cName) instead.

• cName | cBody - the name of an image file or a string with a


previously loaded image file content;
• lMem - a logical variable must be set to .T., if a first
parameter is a string with an image file content;
• Return value - handle of a bitmap;

hwg_OpenBitmap( cName [, hDC] )


Creates a bitmap from the data stored in the bmp file. In most cases
you don't need to call this function directly, use
HBitmap():AddFile(cName) instead.

• cName - name of a bmp file;


• hDC - (optional) handle to a current device context.
• Return value - handle of a bitmap;
hwg_SaveBitmap( cName, hBitmap )

hwg_StockBitmap( cName [,nSizeType] ) (GTK only)


GTK has a number of predefined stock icons, which can be used in
application. It is very convenient because it saves the programmer
from having to store the image files included with the executable.
This function creates a bitmap from a stock object. In most cases you
don't need to call this function directly, use
HBitmap():AddStandard(cName) instead.

• cName - name of a stock object. The set of names you may see,
for example, with the help of Tutorial utility, chapter
"Advanced using of controls", module "Browse of bitmaps" ;
• nSizeType - (optional) type of a size, may be one of following:
GTK_ICON_SIZE_MENU,
GTK_ICON_SIZE_SMALL_TOOLBAR,
GTK_ICON_SIZE_LARGE_TOOLBAR,
GTK_ICON_SIZE_BUTTON (default),
GTK_ICON_SIZE_DND,
GTK_ICON_SIZE_DIALOG;
• Return value - handle of a bitmap;

hwg_DrawBitmap( hDC, hBitmap, style, x, y [, width, height]


)
Draws a bitmap.

• hDC - handle of device context;


• hBitmap - handle of a bitmap (oBitmap:handle usually);
• style - (optional parameter, for WinAPI only). By default the
value is SRCCOPY: copies the source rectangle directly to the
destination rectangle;
• x, y - coordinates of a point where to start drawing bitmap
(left top corner);
• width, height - width and height of a destination image
(optional parameters, by default - original bitmap size).

hwg_DrawTransparentBitmap( hDC, hBitmap, x, y [,trColor] [,


width, height] )
Draws a transparent bitmap.

• hDC - handle of device context;


• hBitmap - handle of a bitmap (oBitmap:handle usually);
• x, y - coordinates of a point where to start drawing bitmap
(left top corner);
• trcolor - transparent color;
• width, height - width and height of a destination image
(optional parameters, by default - original bitmap size).

hwg_Drawgraybitmap( hDC, hBitmap, x, y ) (Windows only)


Draws a bitmap in grayscale mode.

• hDC - handle of device context;


• hBitmap - handle of a bitmap (oBitmap:handle usually);
• x, y - coordinates of a point where to start drawing bitmap
(left top corner).

hwg_SpreadBitmap( hDC, hBitmap [, nLeft, nTop, nRight,


nBottom] )
This funtion spreads a bitmap over all the drawing area or within
rectangle with passed coordinates by multiplying.

• hDC - handle of device context;


• hBitmap - handle of a bitmap (oBitmap:handle usually);
• nLeft, nTop, nRight, nBottom - coordinates of a rectangle
(optional).

hwg_Drawicon( hDC, hIcon, x1, y1 ) (Windows only)


Draws an icon.

• hDC - handle of device context;


• hIcon - handle of an icon (oIcon:handle usually);
• x, y - coordinates of a point where to start drawing an icon
(left top corner);

hwg_CenterBitmap( hDC, hWnd, hBitmap, style, brush )


(Windows only)

hwg_GetBitmapSize( hBitmap )
Returns an array with the size (width and height) of a bitmap.

• hBitmap - handle of a bitmap (oBitmap:handle usually);


• Return value - an array:
aArray[1] - width of a bitmap;
aArray[2] - height of a bitmap.

hwg_GetIconSize( hIcon ) (Windows only)


Returns an array with the size (width and height) of an icon.

• hBitmap - handle of an icon (oIcon:handle usually);


• Return value - an array:
aArray[1] - width of an icon;
aArray[2] - height of an icon.

hwg_Getsyscolor( nCode )
Retrieves the current color of the specified display element. Display
elements are the parts of a window and the display that appear on the
system display screen. In GTK version always return a background color
of a main window.

• nCode - look at MSDN, GetSysColor() function.


• Return value - numeric color representation.
hwg_GetsyscolorBrush( nCode ) (Windows only)
Retrieves a brush handle, corresponding to a current color of the
specified display element. Display elements are the parts of a window
and the display that appear on the system display screen.

• nCode - look at MSDN, GetSysColor() function.


• Return value - a brush handle.

hwg_Createpen( nStyle, nWidth, nColor )


Creates a pen with given parameters. Usually it isn't needed to call
this function directly, use HPen():Add() instead.

• nStyle - a pen style ( PS_SOLID, PS_DASH, PS_DOT, ... );


• nWidth - a pen thickness;
• nColor - numeric color representation;
• Return value - a pen handle.

hwg_Createsolidbrush( nColor )
Creates a brush that has the specified color. Usually it isn't needed
to call this function directly, use HBrush():Add() instead.

• nColor - numeric color representation;


• Return value - a brush handle.

hwg_Createhatchbrush( nHatch, nColor ) (Windows only)


Creates a brush that has the specified hatch pattern and color.
Usually it isn't needed to call this function directly, use
HBrush():Add() instead.

• nHatch - the hatch style of the brush, look at MSDN,


CreateHatchBrush() function.;
• nColor - numeric color representation;
• Return value - a brush handle.

hwg_GetDC( hWnd )
Returns handle of device context of GUI element. After using this
handle must be released with a help of hwg_ReleaseDC( hWnd, hDC ).

• hWnd - handle of GUI element;


• Return value - handle of device context.

hwg_ReleaseDC( hWnd, hDC )


Releases handle of device context, which was created using hwg_GetDC(
hWnd ).

• hWnd - handle of appropriate GUI element;


• hDC - handle of device context.
hwg_SaveDC( hDC ) (Windows only)

hwg_DeleteDC( hDC ) (Windows only)

hwg_Restoredc( hDC, nSavedDC ) (Windows only)

hwg_CreateCompatibleDC( hDC )

hwg_CreateCompatibleBitmap( hDC, nWidth, nHeight ) (Windows


only)

hwg_Patblt( hDc, a, s, d, f, g ) (Windows only)

hwg_Bitblt( hDc, x, y, nWidth, nHeight, pSrcDC, xSrc, ySrc,


nFlag )

hwg_Setmapmode( hDC, nMapMode ) (Windows only)

hwg_Setwindoworgex( hDC, x, y, @point ) (Windows only)

hwg_Setwindowextex( hDC, x, y, @point ) (Windows only)

hwg_Setviewportorgex( hDC, x, y, @point ) (Windows only)

hwg_Setviewportextex( hDC, x, y, @point ) (Windows only)

hwg_Setarcdirection( hDC, nArcDirection ) (Windows only)

hwg_Setrop2( hDC, nDrawMode ) (Windows only)

hwg_DrawFrameControl( hDC, nType, nState ) (Windows only)

hwg_TextOut( hDC, x, y, cText )


Draws a text. Uses a font, selected with the help of
hwg_SelectObject().

• hDC - handle of the device context;


• x1, y1 - coordinates of a start point.
• cText - the text string to draw.

hwg_DrawText( hDC, cText, x1 | aRect [, y1, x2, y2, nStyle


[,aRect]] )
Draws a text in a given rectangle, aligned accorgingly to a passed
parameter. Uses a font, selected with the help of hwg_SelectObject().

• hDC - handle of the device context;


• cText - the text string to draw.
• x1, y1, x2, y2 - text area coordinates;
• aRect - an array with text area coordinates, may be passed
instead of x1, y1, x2, y2;
• nStyle - alignment style: DT_LEFT (by default), DT_CENTER,
DT_RIGHT.
hwg_GetTextMetric( hDC )
Returns an array with geometric text parameters for a given device
contect, for a font, selected with the help of hwg_SelectObject().

• hDC - handle of the device context;


• Return value - an array:
array[1] - a text height,
array[2] - average character width;
array[3] - maximal character width; (WinAPI only)
array[4] - tmExternalLeading; (WinAPI only)
array[5] - tmInternalLeading; (WinAPI only)
array[6] - tmAscent; (WinAPI only)
array[7] - tmDescent; (WinAPI only)
array[8] - tmWeight. (WinAPI only)

hwg_GetTextSize( hDC, cText )


Returns an array with geometric text size for a given device contect,
for a font, selected with the help of hwg_SelectObject().

• hDC - handle of the device context;


• Return value - an array:
array[1] - a text width,
array[2] - a text height;

hwg_GetClientRect( handle )

hwg_GetWindowRect( handle )

hwg_SetTextColor( hDC, nColor )


Sets text color for a drawing.

• hDC - handle of the device context;


• nColor - new color value;
• Return value - previous color value.

hwg_GetTextColor( hDC )
Returns current text color setting for a drawing area.

• hDC - handle of the device context;


• Return value - previous color value.

hwg_SetBkColor( hDC, nColor )


Sets background color for a drawing.

• hDC - handle of the device context;


• nColor - new color value;
• Return value - previous color value.

hwg_GetBkColor( hDC )
Returns current background color setting for a drawing area.
• hDC - handle of the device context;
• Return value - previous color value.

hwg_SetTransparentMode( hDC, lTransparent )


Sets or unsets a transparent mode for a writing text on a drawing
area.

• hDC - handle of the device context;


• lTransparent - boolean value, sets a transparent mode if true,
unsets - if false.

hwg_Exttextout( hDC, x, y, x1, y1, x2, y2, cText ) (Windows


only)

hwg_WindowFromDC( hDC ) (Windows only)


Retrieves a handle of GUI element by it hDC.

• hDC - handle of device context;


• Return value - handle of GUI element.

hwg_Loadimage( hInstance, cName, nType, nWidth, nHeight,


nFlags ) (Windows only)

hwg_Loadbitmap( nId | cName [,l] ) (Windows only)

hwg_Window2bitmap( hWnd [, x1, y1, width, height] )


Creates a bitmap from a given region of a window or control. If
coordinates aren't passed, the whole window is used.

• hWnd - window handle;


• x1, y1 - coordinates of a top left corner of a selected region;
• width, height - width and height of a selected region;
• Return value - handle of a bitmap.

hwg_RedrawWindow( handle, nFlags, x1, y1, nWidth, nHeight )

hwg_Invalidaterect( handle, lEraseBack, x1, y1, x2, y2 )

hwg_GetPpsRect( pps ) (Windows only)

hwg_GetPpsErase( pps ) (Windows only)

hwg_GetUpdateRect( hWnd ) (Windows only)

5.4. Windows handling functions.


hwg_GetModalDlg()

• Return value - an object of HDialog class, a current modal


dialog; Nil - if there is no opened modal dialog.
hwg_EndDialog( [handle] )
Closes a dialog with a handle; if handle isn't passed, the current
modal dialog is closed.

• handle - optional parameter, a handle of a dialog window, which


should be closed.

hwg_EndWindow()
Closes the main window.

hwg_isWindow( hWnd ) (Windows only)


Determines whether the specified window handle identifies an existing
window.

• Return value (logical) - .T., if the window handle identifies an


existing window.

hwg_FlashWindow( hWnd ) (Windows only)


Flashes the specified window one time - change the appearance of its
caption bar as if the window were changing from inactive to active
status, or vice versa.

• hWnd - window handle.

hwg_GetActiveWindow()

• Return value - handle of an active window.

hwg_GetInstance (Windows only)

hwg_SetWindowStyle( handle, nStyle ) (Windows only)


This function sets a WinAPI style to GUI element.

• handle - handle of GUI element;


• nStyle - WinAPI style.

hwg_GetWindowStyle( handle ) (Windows only)


This function returns a WinAPI style of GUI element.

• handle - handle of GUI element;


• Return value - (numeric) WinAPI style.

hwg_SetWindowExtStyle( handle, nStyle ) (Windows only)


This function sets an extended WinAPI style to GUI element.

• handle - handle of GUI element;


• nStyle - an extended WinAPI style.
hwg_GetWindowExtStyle( handle ) (Windows only)
This function returns an extended WinAPI style of GUI element.

• handle - handle of GUI element;


• Return value - (numeric) an extended WinAPI style.

hwg_FindWindow( cClassName, cWindowName) (Windows only)

hwg_SetForegroundWindow( handle ) (Windows only)

hwg_BringToTop( handle ) (Windows only)


Sets the window over all other windows.

• handle - window handle.

hwg_ResetWindowPos( handle ) (Windows only)

hwg_UpdateWindow( handle ) (Windows only)

hwg_CenterWindow( handle )
Centers a window on a screen.

• handle - window handle.

hwg_RestoreWindow( handle )
Restores the default window size.

• handle - window handle.

hwg_EnableWindow( handle, lEnable )


Enables or disables GUI element (window or control).

• handle - handle of a GUI element;


• lEnable - (logical) enable, if .T., disable if .F..

hwg_isWindowEnabled( handle )
Checks, if the GUI element (window or control) is enabled.

• handle - handle of a GUI element;


• Return value - (logical) .T., if GUI element is enabled.

hwg_HideWindow( handle )
Hide GUI element (window or control).

• handle - handle of a GUI element.


hwg_ShowWindow( handle )
Show GUI element (window or control).

• handle - handle of a GUI element.

hwg_ProcessMessage( [lMdi] [, nSleep] )

hwg_PeekMessage( hWnd ) (Windows only)

hwg_DoEvents() (Windows only)

hwg_SendMessage( handle, nMessage, wParam, lParam ) (Windows


only)

hwg_PostMessage( handle, nMessage, wParam, lParam ) (Windows


only)

hwg_SetWindowObject( handle, object )

hwg_GetWindowObject( handle )

hwg_SetWindowText( handle, cTitle )


Changes the text of the specified window's title bar or the text of a
control.

• handle - handle of a GUI element;


• cTitle - the text.

hwg_GetWindowText( handle )
Returns the text of the specified window's title bar or the text of a
control.

• handle - handle of a GUI element;


• Return value - the text.

hwg_SetWindowFont( handle, hFont, l ) (Windows only)

hwg_GetLastError() (Windows only)


Retrieves the calling thread's last-error code value.

• Return value - (numeric) error code value.

hwg_isIconic( hWnd ) (Windows only)


Determines whether the specified window is minimized (iconic).

• hWnd - a window handle.


• Return value - (logical) .T., if window is minimized.
hwg_isWindowVisible( hWnd ) (Windows only)
Returns a window state (visible/hidden).

• hWnd - a window handle.


• Return value - (logical) .T., if window is visible, .F. - if
hidden.

hwg_ExitProcess() (Windows only)

hwg_WindowSetResize( hWnd, lResizeable )


Sets the window resizeable or no resizeable.

• hWnd - handle of a window;


• lResizeable - boolean argument.

hwg_SetTopmost( hWnd )
Sets a window as Topmost, i.e. makes it visible independently of it
state (is it active or no).

• hWnd - a window handle.

hwg_RemoveTopmost( hWnd )
Resets the Topmost mode (look at hwg_SetTopmost()).

• hWnd - a window handle.

hwg_ChildWindowFromPoint( hWnd, x, y ) (Windows only)

hwg_WindowFromPoint( hWnd, x, y ) (Windows only)

hwg_GetFontDialogUnits( hWnd ) (Windows only)

hwg_GetWindowPlacement( handle ) (Windows only)

hwg_ClearKeyboard() (Windows only)

5.5. Controls handling functions.


hwg_SetFocus( handle )
Sets the keyboard focus to the specified GUI element (window or
control).

• handle - handle of a GUI element;


• Return value - handle to the GUI element that previously had the
keyboard focus.

hwg_GetFocus()
Retrieves the handle to the GUI element (window or control) that has
the keyboard focus.
• Return value - handle to the GUI element that has the keyboard
focus.

hwg_WriteStatus( oWnd, nPart, cText, lRedraw )


Writes a text string to a fragment of a status pane. This function
works for a standard Status and or a Status Panel.

• oWnd - the window with the status pane, an object of one of


subclasses of HWindow class;
• nPart - a number of a fragment of the status pane;
• CText - a text for the status pane;
• lRedraw - .T., to redraw status pane immedeately.

hwg_FindParent( hCtrl )
Returns an object of a parent GUI element for a widget by it handle.

• hCtrl - a handle of a widget;


• Return value - an object of a parent GUI element.

hwg_FindSelf( hCtrl )
Returns an object of a widget by it handle.

• hCtrl - a handle of a widget;


• Return value - an object of a widget.

hwg_getParentForm( oCtrl )
Returns an object of a window, which includes a given widget. The
distinction from hwg_FindParent() is the following: hwg_FindParent()
looks for a direct parent, it may be another widget, such as Tab,
Panel or Toolbar. hwg_getParentForm() always returns a window, which
includes the given widget.

• oCtrl - an object of a widget;


• Return value - an object of a window.

hwg_MoveWindow( handle, nLeft, nTop, nWidth, nHeight,


lRepaint )

hwg_DestroyWindow( handle )

hwg_Createarlist( oBrw, arr )

hwg_CreateList( oBrw, lEditable )

hwg_VScrollPos( oBrw, nType, lEof, nPos )

hwg_HScrollPos( oBrw, nType, lEof, nPos )

hwg_ColumnArBlock()
hwg_ShowProgress( nStep, maxPos, nRange, cTitle, oWnd, x1,
y1, width, height ) (Windows only)

hwg_UpdateProgressBar( handle )

hwg_SetProgressBar( handle, nPos )

hwg_SetRangeProgressBar( handle, nValue )

hwg_trackbarsetrange( handle, nLow, nHigh ) (Windows only)

hwg_SetMonthCalendarDate( handle , dValue )

hwg_GetMonthCalendarDate( handle )

hwg_Setctrlfont( parentHandle, nId, hFont ) (Windows only)

hwg_Setctrlfont( handle, hFont ) (GTK only)

hwg_AddTooltip( handle, cTooltip )


Add a tooltip to the control.

• handle - handle of the control;


• cTooltip - a text of a tooltip.

hwg_DelTooltip( handle )
Delete a tooltip of the control.

• handle - handle of the control.

hwg_SetTooltipTitle( handle, cTooltip )


Update the text of a tooltip.

• handle - handle of the control;


• cTooltip - a new text of a tooltip.

hwg_SetUpdown( handle, nValue )

hwg_SetRangeUpdown( handle, n1, n2 )

hwg_SetDatePicker( handle, dValue ) (Windows only)

hwg_SetDatePickerNull( handle ) (Windows only)

hwg_GetDatePicker( handle ) (Windows only)

hwg_GetTimePicker( handle ) (Windows only)

hwg_AddTab( handle, cName )

hwg_DeleteTab( handle, nPage )


hwg_GetCurrentTab( handle )

hwg_SetCurrentTab( handle, nPage ) (GTK only)

hwg_SetTabSize( handle, nWidth, nHeight ) (Windows only)

hwg_GetTabHeight( handle ) (Windows only)

hwg_SetTabName( handle, nPage, cName )

hwg_CreateImageList( aImages, nWidth, nHeight, nGrow,


nFlags ) (Windows only)

hwg_DestroyImageList( handle ) (Windows only)

hwg_Imagelist_Add( handle, hBitmap ) (Windows only)

hwg_Imagelist_AddMasked( handle, hBitmap, nMask ) (Windows


only)

hwg_ImageList_GetImageCount( handle ) (Windows only)

hwg_getParent( handle )
Returns handle of a parent GUI element, using a system call WinAPI/GTK
- so, it is faster, than with the help of oParent variable of
appropriate object.

• handle - handle of a control;


• Return value - handle of a parent GUI element.

hwg_getAncestor( handle ) (Windows only)

hwg_LoadCursor( cursor )

hwg_SetCursor( cursor, hCtrl )

• cursor - cursor handle;


• hCtrl - handle of the widget under cursor (GTK only).

hwg_GetCursor() (Windows only)

hwg_SetTooltipBalloon( lBalloon ) (Windows only)

hwg_GetTooltipBalloon() (Windows only)

hwg_SetDlgItemText( parentHandle, nId, cText ) (Windows only)


Sets the title or text of a control.

• parentHandle - handle of a parent window (oCtrl:oParent:handle);


• nId - id of a control (oCtrl:id);
• cText - text string to be set.
hwg_GetDlgItemText( parentHandle, nId ) (Windows only)
Retrieves the title or text associated with a control.

• parentHandle - handle of a parent window (oCtrl:oParent:handle);


• nId - id of a control (oCtrl:id);
• Return value - text string, displayed in a control.

hwg_GetEditText( parentHandle, nId ) (Windows only)


Retrieves the text associated with an edit control.

• parentHandle - handle of a parent window (oCtrl:oParent:handle);


• nId - id of a control (oEdit:id);
• Return value - text string, displayed in an edit control.

hwg_CheckDlgButton( parentHandle, nId, lValue ) (Windows


only)

hwg_isDlgButtonChecked( parentHandle, nId ) (Windows only)

hwg_ComboAddString( handle, cText ) (Windows only)

hwg_ComboInsertString( handle, nPos, cText ) (Windows only)

hwg_ComboSetString( handle, nPos ) (Windows only)

hwg_ListboxAddString( handle, cValue ) (Windows only)

hwg_ModifyStyle( hWnd, nStyleDel, nStyleAdd ) (Windows only)

hwg_re_SetCharFormat( hCtrl, n1, n2, nColor, cName,


nHeight, lBold, lItalic, lUnderline, nCharset,
lSuperScript/lSubscript, lProtected ) (Windows only)

hwg_re_SetDefault( hCtrl, nColor, cName, nHeight, lBold,


lItalic, lUnderline, nCharset ) (Windows only)

hwg_re_CharFromPos( hEdit, xPos, yPos ) (Windows only)

hwg_re_GetTextRange( hEdit, n1, n2 ) (Windows only)

hwg_re_GetLine( hEdit, nLine ) (Windows only)

hwg_re_InsertText( hEdit, cText ) (Windows only)

hwg_re_FindText( hEdit, cFind, nStart, bCase, bWholeWord,


bSearchUp ) (Windows only)

hwg_re_SetZoom( hEdit, nNum, nDen ) (Windows only)

hwg_re_SetZoomOff( hEdit ) (Windows only)

hwg_re_GetZoom( hEdit, @nNum, @nDen ) (Windows only)


hwg_PrintRtf( hEdit, hDC ) (Windows only)

hwg_SaveRichedit( hEdit, cFileName ) (Windows only)

hwg_LoadRichedit( hEdit, cFileName ) (Windows only)

5.6. Menu functions.


Hwg_AddMenuItem( aMenu, cItem, nMenuId, lSubMenu, bItem,
nPos )

Hwg_DefineMenuItem( cItem, nId, bItem, lDisabled, accFlag,


accKey, lBitmap, lResource, lCheck )

Hwg_DefineAccelItem( nId, bItem, accFlag, accKey )

Hwg_InsertBitmapMenu( aMenu, nId, lBitmap, oResource )


(Windows only)

Hwg_SetMenuItemBitmaps( aMenu, nId, abmp1, abmp2 ) (Windows


only)

hwg_DeleteMenuItem( oWnd, nId )

Hwg_FindMenuItem( aMenu, nId, nPos )

hwg_CheckMenuItem( hWnd, nId, lValue )

hwg_IsCheckedMenuItem( hWnd, nId )

hwg_EnableMenuItem( hWnd, nId, lValue )

hwg_IsEnabledMenuItem( hWnd, nId )

hwg_SetMenuCaption( hWnd, nId, cText )

hwg_GetMenuCaption( hWnd, nId )

hwg_DrawMenuBar( hWnd )

hwg_SetMenuBackColor( hWnd, nColor[, lSubmenus] )

5.7. Windows registry.


hwg_RegCreateKey( handle, cKeyName ) (Windows only)

hwg_RegOpenKey( handle, cKeyName ) (Windows only)

hwg_RegCloseKey( handle ) (Windows only)

hwg_RegSetString( handle, cKeyName, cKeyValue ) (Windows


only)
hwg_RegSetBinary( handle, cKeyName, cBinValue ) (Windows
only)

hwg_RegGetValue( handle, cKeyName [,nType] ) (Windows only)

5.8. Miscellaneous functions.


hwg_GetItemByName( arr, cName )
Returns an object from an array by its name, which is kept as
:objname.

• arr - an array with HwGUI objects,


• cName - a name of HwGUI object.

hwg_Version( n )
Returns an information about current HwGUI version. The optional
parameter defines the kind of information:

• n == 1: returns a short string with version number, e.g. "2.20",


• n == 2: returns an integer build number,
• n == 3: returns a logical value, which tells, if this is a
UNICODE build,
• n is omitted: returns a string with full information.

hwg_WriteLog( cText [, fname] )


Adds a text to a file, the functions is intended for debugging
purposes.

• cText - the text to be written;


• fname - (optional) a file name, the default is "a.log".

hwg_SetDlgKey( [oDlg], nCtrl, nKey, block [, lGlobal] )


Sets a "hot key" for a window/dialog or globally - for all the
application. There is appropriate command, which is preprocessed into
this function: SET KEY.

• oDlg - (optional, default value is default parent window) an


object of subclass of HWindow, the window, a key is set for;
• nCtrl - a code of a control key (e.g. FCONTROL), 0 - if not
defined;
• nKey - a key code,
• block - a codeblock, which should be evaluated while pressing
the key;
• lGlobal - (optional, default is .F.) - logical value, which
determines, if the "hot key" is set globally.

hwg_ColorC2N( cColor )
Converts color representation from string to numeric format.

• cColor - a string in #RRGGBB format, describing the color;


• Return value - an integer representation of a color.

hwg_ColorN2C( nColor )
Converts color representation from numeric to string format.

• nColor - an integer representation of a color;


• Return value - a string in RRGGBB format, describing the color.

hwg_ColorN2RGB( nColor [, @nRed, @nGreen, @nBlue] )


Converts color representation from one numeric value to three, which
corresponds to red, green and blue. You may get the result by passing
parameters by reference or using the return value.

• nColor - an integer representation of a color;


• nRed - (optional) red component, passed by reference;
• nGreen - (optional) green component, passed by reference;
• nBlue - (optional) blue component, passed by reference;
• Return value - an array of three numbers, which corresponds to
red, green and blue color components.

hwg_ColorRgb2N( nRed, nGreen, nBlue )


Converts three color components (red, green and blue) to a numeric
value.

• nRed - red component;


• nGreen - green component;
• nBlue - blue component;
• Return value - a numeric color representation.

hwg_BmpFromRes( cBmp )
Creates a bitmap from the data stored in the resources or in the
binary container (if it is previouslu opened with
hwg_SetResContainer() function). In most cases you don't need to call
this function directly, use HBitmap():AddResource(cBmp) instead.

• cName - name of a bmp resource;


• Return value - handle of a bitmap;

hwg_SetResContainer( cName )
Opens a file of a binary container and sets is as a current fot
resources retrieving. Corresponding command: SET RESOURCES CONTAINER
TO.

• cName - a full path and name of a binary container;


• Return value - (logical) .T., if a file is opened successfully
and .F. - in other case.

hwg_SetCtrlName( oCtrl, cName )


hwg_RefreshAllGets( oDlg )
Refresh the state of all GET-elements in a window.

• oDlg - the window with GET-elements, an object of one of


subclasses of HWindow.

hwg_IsCtrlShift( lCtrl, lShift ) (Windows only)

hwg_GetSkip( oParent, hCtrl, nSkip )


Sets the input focus to other GET item.

• oParent - an object of a parent window;


• hCtrl - a handle of a control;
• nSkip - a number of GET items to skip (positive or negative).

hwg_SetGetUpdated( oEdit )
Sets the state of a GET item as updated.

• oEdit - a GET item, an object of a HEDIT class.

hwg_SetColorinFocus( lDef, tColor, bColor )

hwg_Chr( nCode )
hwg_Substr( cString, nPos, nLen )
hwg_Left( cString, nLen )
hwg_Len( cString )

hwg__isUnicode()
Lets to determine, is this HwGUI binary compiled in Unicode mode.

• Return value - (logical) .T., if Hwgui library is build with


Unicode support.

hwg_GetPrinters()
Returns a list of printers, registered in OS.

• Return value - an array of printers names.

hwg_Createfont( fontName, nWidth, nHeight, fnWeight,


fdwCharSet, fdwItalic, fdwUnderline, fdwStrikeOut )

hwg_GetFontsList()
Returns a list of fonts, registered in OS.

• Return value - an array of fonts names.

hwg_HdSerial( cDrive ) (Windows only)


hwg_HdGetSerial( cDrive ) (Windows only)

Hwg_GetIni( cSection, cEntry, cDefault, cFile ) (Windows


only)

Hwg_WriteIni( cSection, cEntry, cValue, cFile ) (Windows


only)

hwg_TxtRect( cTxt, oWin, oFont )

hwg_ErrMsg( oError )

hwg_ShellNotifyIcon( lAdd, hWnd, hIcon, cTooltip ) (Windows


only)

hwg_ShellModifyIcon( hWnd, hIcon, cTooltip ) (Windows only)

hwg_ShellExecute( cFile, cOperation, cParams, cDir, nFlag )

hwg_GetLocaleInfo() (Windows only)

Hwg_SetDlgResult( handle, nValue ) (Windows only)

hwg_SetCapture( hWnd ) (Windows only)

hwg_ReleaseCapture() (Windows only)

hwg_CopyStringToClipboard( cString )

hwg_GetClipboardText( hWnd )

hwg_GetStockObject( nId ) (Windows only)

hwg_LoWord( n )
Retrieves the low-order word from the specified 32-bit value.

• n - the value to be converted;


• Return value - the low-order word of the specified value.

hwg_HiWord( n )
Retrieves the high-order word from the specified 32-bit value.

• n - the value to be converted;


• Return value - the high-order word of the specified value.

hwg_BitOr( n1, n2 )
hwg_BitAnd( n1, n2 )
hwg_BitAndInverse( n1, n2 )
hwg_SetBit( n, nBit )
hwg_CheckBit( n, nBit )
Bit functions as in Harbour ( hb_bitand(),... ).
hwg_Sin( n )
hwg_Cos( n )
Two mathematical functions.

hwg_ClientToScreen( handle, x1, y1 ) (Windows only)

hwg_ScreenToClient( handle, x1, y1 ) (Windows only)

hwg_GetCursorPos() (Windows only)

hwg_SetCursorPos( x, y ) (Windows only)

hwg_WinExec( cCommand, nFlag ) (Windows only)

hwg_GetKeyboardState( nState )
This function returns a keyboard state string, which allows to
determine, is Ctrl, Shift or Alt key is pressed. It should be called
inside events handler, in GTK version lParam must be passed as nState
parameter.

• nState - lParam (third parameter in an event handler) - for GTK


version only;
• Return value - a 255 bytes length string.

hwg_Getkeystate( nKey ) (Windows only)

hwg_GetKeyNameText( nCode ) (Windows only)

hwg_Pts2Pix( nPoints [,hDC] ) (Windows only)

hwg_GetWindowsDir() (Windows only)

hwg_GetSystemDir() (Windows only)

hwg_GetTempDir() (Windows only)

hwg_Postquitmessage( nExitCode ) (Windows only)

hwg_GetDesktopWidth()
Returns a width of a desktop in pixels.

hwg_GetDesktopHeight()
Returns a height of a desktop in pixels.

hwg_GetNextDlgTabItem ( parentHandle, ::handle, lNext )


(Windows only)
Returns a handle of a next or previous control in a window.

• parentHandle - handle of a parent window;


• handle - handle of a current control;
• lNext - .T., if a next control is demanded, .F. - if the
previous;
• Return value - handle of a next or previous control.
hwg_Sleep( n )

hwg_SetScrollInfo( handle, nType, nRedraw, nHScrollPos ,


nPage, nHscrollMax ) (Windows only)

hwg_GetScrollRange( handle, nType, @minPos, @maxPos )


(Windows only)

hwg_SetScrollRange( handle, nType, minPos, maxPos ) (Windows


only)

hwg_GetScrollPos( handle, nType ) (Windows only)

hwg_SetScrollPos( handle, nType, nPos ) (Windows only)

hwg_ShowScrollBar( handle, nType, lShow ) (Windows only)

hwg_ScrollWindow( handle, n1, n2 ) (Windows only)

hwg_isCapslockActive() (Windows only)

hwg_isNumlockActive() (Windows only)

hwg_isScrolllockActive() (Windows only)

hwg_CreateDirectory( cDirName ) (Windows only)

hwg_RemoveDirectory( cDirName ) (Windows only)

hwg_SetCurrentDirectory( cDirName ) (Windows only)

hwg_DeleteFile( cFileName ) (Windows only)

hwg_GetFileAttributes( cFileName ) (Windows only)

hwg_SetFileAttributes( cFileName, nAttr ) (Windows only)

hwg_GetComputerName() (Windows only)

hwg_GetUserName( [@nLength] ) (Windows only)

hwg_PtrToUlong( ptr )
Converts a variable of Pointer type to a long integer. This is
necessary in some cases for handling parameters of system messages.

• ptr - a variable of Pointer type;


• Return value - long integer.

hwg_Isptreq( handle1, handle2 )


Compares two pointers, returns .T., if they are equal.

hwg_OutputDebugString( cText ) (Windows only)

hwg_Getsystemmetrics( nCode ) (Windows only)


hwg_GetBackBrush( handle ) (Windows only)

hwg_LastKey() (Windows only)

hwg_isWin7() (Windows only)

hwg_ProcessRun( cCommand ) (Windows only)

hwg_RunConsoleApp( cCommand [, cOutFile] )


Executes a console program in sync mode, waiting for result.

• cCommand - a command line to execute;


• cOutFile - optional parameter, a file name for program output;
• Return value - (integer) program exit code.

hwg_RunApp( cCommand [, nFlag] [, lAsync] )

hwg_onAnchor( oWnd, wold, hold, wnew, hnew )

prev table of contents next


commands classes

Site map
© Copyright 2016. All Rights Reserved.
<div><img src="https://mc.yandex.ru/watch/37824975"
style="position:absolute; left:-9999px;" alt="" /></div>

S-ar putea să vă placă și