AChoice()

 

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 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

3 responses to “AChoice()

  1. Pingback: Harbour All Functions — A | Viva Clipper !

  2. Pingback: Harbour Menu Functions | Viva Clipper !

  3. Pingback: Harbour RG Summary | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.