Contributed works of Danny A. del Pilar
How to build menu like old ACHOICE function?
KPI (Key Performance Indicator) Dashboard
How to build menu like old ACHOICE function?
KPI (Key Performance Indicator) Dashboard
Displays a text-mode dialog box with a message.
Syntax
HB_Alert( <xMessage>, [<aOptions>], [<cColor>], [<nDelay>] ) --> nChoice
Arguments
<xMessage> : The message to display. May be any data type. Character string may be divided display lines by the semicolon
<aOptions> : An array with available response as character strings. Default is { “Ok” }.
<cColor> : A string as color codes. Default color is “W+/R”.
<nDelay> : Number of seconds to wait to user response before abort. Default value is 0, that wait forever.
Returns
A numeric value indicating the ordinal position within <aOption> selected by the user. Zero value means that user pressed escape key.
If <nDelay> is specified and this number of seconds has elapsed without a key press, the return value is 1.
Description
HB_Alert() displays a dialog box and lets the user select an option. The user can move a highlight bar using arrow keys or the TAB key. To select an option, the user can press ENTER, SPACE or the first letter of an option.
HB_Alert() is extended version of Alert() to support all variables types (not just strings) is passed as first parameter.
Example
// This example displays a message with two line : file name and 'not found' message. // After 15 seconds without user response, assumed 'Abort' selected. FUNCTION FNFMessage( cFileName ) LOCAL cMessage, aOptions, nChoice aMessage := { cFileName, 'Not found !' } aOptions := { 'Abort', 'Retry', 'Skip' } nChoice := HB_Alert( aMessage, aOptions, , 15 ) RETURN nChoice // FNFMessage()
Seealso
Declare a module request list
Syntax
REQUEST <name1> [,<nameN>]
Arguments
<idModule list> is the list of modules that will be linked into the current executable (.EXE) file.
Description
REQUEST is a declaration statement that defines a list of module identifiers to the linker. Like all other declaration statements, a REQUEST statement must be specified before any executable statements in either the program file, or a procedure or user-defined function definition.
During the compilation of Clipper source code, all explicit references to procedures and user-defined functions are made to the linker. In some instances, within a source file, there may be no references made to procedure or user-defined function names until runtime. REQUEST resolves this situation by forcing the named procedures or user-defined functions to be linked even if they are not explicitly referenced in the source file. This is important in several instances:
. Procedures, user-defined functions, or formats referenced with macro expressions or variables
. Procedures and user-defined functions used in REPORT and LABEL FORMs and not referenced in the source code
. User-defined functions used in index keys and not referenced in the source code
. ACHOICE(), DBEDIT(), or MEMOEDIT() user functions
. Initialization procedures declared with the INIT PROCEDURE statement
. Exit procedures declared with the EXIT PROCEDURE statement
To group common REQUESTs together, place them in a header file and then include (#include) the header file into each program file (.prg) that might indirectly use them.
Examples
. This example shows a typical header file consisting of common REQUESTs for REPORT FORMs: // Request.ch REQUEST HARDCR REQUEST TONE REQUEST MEMOTRAN REQUEST STRTRAN OR : REQUEST HARDCR, TONE, MEMOTRAN, STRTRAN
Seealso
ACHOICE(), ANNOUNCE, DBEDIT(), EXIT, PROCEDURE; EXTERNAL*
Allows selection of an element from an array
Syntax
ACHOICE(<nTop>, <nLeft>, <nBottom>, <nRight>,; <acMenuItems>, [<alSelableItems> | <lSelableItems>],; [<cUserFunction> | <bUserBlock>], [<nInitialItem>],; [<nWindowRow>]) --> nPosition
Arguments
<nTop> – topmost row used to display array (default 0)
<nLeft> – leftmost row used to display array (default 0)
<nBottom> – bottommost row used to display array (default MaxRow())
<nRight> – rightmost row used to display array (default MaxCol())
<acMenuItems> – the character array of items from which to select
<alSelableItems> – an array of items, either logical or character, which is used to determine if a particular item may be selected. If the type of a given item is character, it is macro evaluated, and the result is expected to be a logical. A value of .T. means that the item may be selected, .F. that it may not. (See next argument: lSelectableItems)
<lSelableItems> – a logical value which is used to apply to all items in acMenuItems. If .T., all items may be selected; if .F., none may be selected. (See previous argument: alSelectableItems) Default .T.
<cUserFunction> – the name of a function to be called which may affect special processing of keystrokes. It is specified without parentheses or parameters. When it is called, it will be supplied with the parameters: nMode, nCurElement, and nRowPos. Default NIL.
<bUserBlock> – a codeblock to be called which may affect special processing of keystrokes. It should be specified in the form {| nMode, nCurElemenet, nRowPos | ; MyFunc( nMode, nCurElemenet, nRowPos ) }. Default NIL.
<nInitialItem> – the number of the element to be highlighted as the current item when the array is initially displayed. 1 origin. Default 1.
<nWindowRow> – the number of the window row on which the initial item is to be displayed. 0 origin. Default 0.
Returns
<nPosition> – the number of the item to be selected, or 0 if the selection was aborted.
Description
Allows selection of an element from an array. Please see standard CA-Cl*pper documentation for ACHOICE for additional detail.
Examples
aItems := { "One", "Two", "Three" } nChoice := AChoice( 10, 10, 20, 20, aItems ) IF nChoice == 0 ? "You did not choose an item" ELSE ? "You chose element " + hb_ntos( nChoice ) ?? " which has a value of " + aItems[ nChoice ] ENDIF
Files
Library is rtl
Compliance
Clipper
Seealso
MENU TO