Harbour Reference Guide

 

ACHOICE()

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 Clipper 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 " + LTRIM( STR( nChoice ) )
          ?? " which has a value of " + aItems[ nChoice ]
      ENDIF

Files

Library is rtl

See Also

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/07/30