* tests/testsha1.prg
* tests/longdev.prg
* tests/clsccast.prg
* tests/cmphello.prg
* tests/clsicast.prg
* tests/testop.prg
* tests/clsscast.prg
* tests/objarr.prg
* tests/rddtest/rddmktst.prg
* tests/rddtest/adscl52.prg
* tests/rddtest/adscl53.prg
* tests/rddtest/ntxcl52.prg
* tests/rddtest/ntxcl53.prg
* tests/rddtest/cdxcl52.prg
* tests/rddtest/rddtst.prg
* tests/rddtest/cdxcl53.prg
* tests/transtst.prg
* tests/output.prg
* tests/ac_test2.prg
* tests/clsscope.prg
* tests/dosshell.prg
* tests/sbartest.prg
* tests/speedold.prg
* tests/sdf_test.prg
* tests/wcecon.prg
* tests/debugtst.prg
* tests/testdyn.c
* tests/multiarg.prg
* tests/fornext.prg
* tests/hbinline.prg
* tests/foreach2.prg
* tests/objasign.prg
* tests/scroll.prg
* tests/inherit.prg
* tests/rto_get.prg
* tests/boxtst2.prg
* tests/inkeytst.prg
* tests/overload.prg
* tests/cpinfo.prg
* tests/gtwin.prg
* tests/mt/mttest08.prg
* tests/mt/mttest09.prg
* tests/mt/mttest01.prg
* tests/mt/mttest10.prg
* tests/mt/mttest02.prg
* tests/mt/mttest11.prg
* tests/mt/mttest03.prg
* tests/mt/mttest12.prg
* tests/mt/mttest04.prg
* tests/mt/mttest05.prg
* tests/mt/mttest06.prg
* tests/mt/mttest07.prg
* tests/speedtst.prg
* tests/testsha2.prg
* tests/hsxtest.prg
* tests/arrayidx.prg
* tests/clsnv.prg
* tests/rto_tb.prg
* tests/gtchars.prg
* tests/disptest.prg
* tests/funcarr.prg
* tests/testhtml.prg
* tests/readhrb.prg
* tests/tstcolor.prg
* tests/gtxfnt.prg
* tests/devtest.prg
* tests/aliaslck.prg
* tests/stripem.prg
* tests/dynobj.prg
* tests/tb1.prg
* tests/round.prg
* tests/longstr.prg
* tests/testdyn.prg
* tests/testdyn1.prg
* tests/delimtst.prg
* tests/tstdspac.prg
* tests/version.prg
* tests/setkeys.prg
* tests/gtcolors.prg
* tests/destruct.prg
* tests/seconds.prg
* tests/gtkeys.prg
* tests/usrrdd/exarr.prg
* doc/en/diskspac.txt
* doc/en/string.txt
* doc/en/rdd.txt
* doc/en/hashes.txt
* doc/en/hb_apigt.txt
* doc/en/rddord.txt
* doc/en/hb_api.txt
* doc/en/hb_date.txt
* doc/en/math.txt
* doc/en/hb_vm.txt
* doc/en/treport.txt
* doc/en/terminal.txt
* doc/en/hb_apiln.txt
* doc/en/dir.txt
* doc/en/command.txt
* doc/en/rddmisc.txt
* doc/en/errsys.txt
* doc/en/nation.txt
* doc/en/var.txt
* doc/en/dbstrux.txt
* doc/en/datetime.txt
* doc/en/memo.txt
* doc/en/tgetlist.txt
* doc/en/tlabel.txt
* doc/en/1stread.txt
* doc/en/hb_set.txt
* doc/en/hb_compa.txt
* doc/en/hb_apier.txt
* doc/en/hbinet.txt
* doc/en/hb_macro.txt
* doc/en/array.txt
* doc/en/hb_apiit.txt
* doc/en/rdddb.txt
* doc/en/dbsdf.txt
* doc/en/hvm.txt
* doc/en/input.txt
* doc/en/dbdelim.txt
* doc/en/browse.txt
* doc/en/menu.txt
* doc/en/hb_apird.txt
* doc/en/hb_apifs.txt
* doc/en/file.txt
* doc/en/lang.txt
* doc/en/objfunc.txt
* doc/en/eval.txt
* doc/en/binnum.txt
* doc/en/tclass.txt
* doc/en/misc.txt
* doc/en/set.txt
* doc/en/readme.txt
* doc/man/harbour.1
* doc/man/hbmk2.1
* doc/man/hbpp.1
* doc/man/hbtest.1
* doc/man/hbrun.1
* examples/hbextern/hbextern.prg
* examples/pp/pp.c
* examples/pp/hbpragma.c
* examples/pp/hbppcore.c
* examples/pp/hbppcomp.c
* examples/pp/hbpptbl.c
* examples/pp/hbppdef.h
* examples/superlib/hbsuper.prg
* examples/hbsqlit2/hbsqlit2.ch
* examples/misc/mankala.prg
* examples/misc/guess.prg
* examples/rddado/adordd.prg
* examples/rddado/adordd.ch
* examples/hbapollo/apollo.ch
* examples/hbapollo/apollo.c
* examples/hbapollo/apollo1.prg
* examples/hbdoc2/gentpl.prg
* examples/hbdoc2/gentxt.prg
* examples/hbdoc2/tmplates.prg
* examples/hbdoc2/genxml.prg
* examples/hbdoc2/genhtml.prg
* examples/hbdoc2/hbdoc2.prg
* examples/hbdoc2/hbdoc2.ch
* examples/guestbk/guestbk.prg
* examples/httpsrv/uhttpd.ini
* examples/httpsrv/uhttpd.prg
* examples/httpsrv/cookie.prg
* examples/httpsrv/cgifunc.prg
* examples/httpsrv/session.prg
* examples/terminal/trm_cli.prg
* examples/terminal/terminal.prg
* examples/terminal/trm_srv.prg
* examples/terminal/trm_app.prg
* examples/hbbtree/hb_btree.h
* examples/hbbtree/hb_btree.ch
* examples/hbbtree/hb_btree.c
* examples/hbbtree/tbtree.prg
* examples/hscript/hscript.prg
* examples/hscript/dir.hs
* examples/hscript/multiply.hs
* examples/hscript/ugly.hs
* examples/hscript/hello.hs
* examples/gtwvw/hbole.h
* examples/gtwvw/wvwdraw.c
* examples/gtwvw/wvwmenu.c
* examples/gtwvw/gtwvw.c
* examples/gtwvw/wvwstbar.c
* examples/gtwvw/wvwcheck.c
* examples/gtwvw/wvwfuncs.c
* examples/gtwvw/wvwpush.c
* examples/gtwvw/wvwedit.c
* examples/gtwvw/wvwtbar.c
* examples/gtwvw/hbgtwvw.h
* Deleted 'www.' from harbour-project.org website name.
(www.harbour-project.org -> harbour-project.org)
400 lines
15 KiB
Plaintext
400 lines
15 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* The following parts are Copyright of the individual authors.
|
|
* www - http://harbour-project.org
|
|
*
|
|
* Copyright 1999 Chen Kedem <niki@actcom.co.il>
|
|
* Documentation for: __ATPROMPT(), @...PROMPT, __MENUTO(), MENU TO
|
|
*
|
|
* See COPYING for licensing terms.
|
|
*
|
|
*/
|
|
|
|
/* $DOC$
|
|
* $TEMPLATE$
|
|
* Function
|
|
* $NAME$
|
|
* ACHOICE()
|
|
* $CATEGORY$
|
|
* API
|
|
* $SUBCATEGORY$
|
|
* User interface
|
|
* $ONELINER$
|
|
* 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 " + LTRIM( STR( nChoice ) )
|
|
* ?? " which has a value of " + aItems[ nChoice ]
|
|
* ENDIF
|
|
* $FILES$
|
|
* Library is rtl
|
|
* $COMPLIANCE$
|
|
* C
|
|
* $SEEALSO$
|
|
* MENU TO
|
|
* $END$
|
|
*/
|
|
|
|
/* $DOC$
|
|
* $TEMPLATE$
|
|
* Function
|
|
* $NAME$
|
|
* __AtPrompt()
|
|
* $CATEGORY$
|
|
* API
|
|
* $SUBCATEGORY$
|
|
* User interface
|
|
* $ONELINER$
|
|
* Display a menu item on screen and define a message
|
|
* $SYNTAX$
|
|
* __AtPrompt( <nRow>, <nCol>, <cPrompt>, [<xMsg>] ) --> .F.
|
|
* $ARGUMENTS$
|
|
* <nRow> is the row number to display the menu <cPrompt>. Value could
|
|
* range from zero to MAXROW().
|
|
*
|
|
* <nCol> is the column number to display the menu <cPrompt>. Value
|
|
* could range from zero to MAXCOL().
|
|
*
|
|
* <cPrompt> is the menu item character string to display.
|
|
*
|
|
* <xMsg> define a message to display each time this menu item is
|
|
* highlighted. <xMsg> could be a character string or code block that
|
|
* is evaluated to a character string. If <xMsg> is not specified or
|
|
* of the wrong type, an empty string ("") would be used.
|
|
* $RETURNS$
|
|
* __AtPrompt() always return .F.
|
|
* $DESCRIPTION$
|
|
* With __AtPrompt() you define and display a menu item, each call to
|
|
* __AtPrompt() add another item to the menu, to start the menu itself
|
|
* you should call the __MenuTo() function (MENU TO command). You can
|
|
* define any row and column combination and they will be displayed at
|
|
* the order of definition. After each call to __AtPrompt(), the cursor
|
|
* is placed one column to the right of the last text displayed, and
|
|
* ROW() and COL() are updated.
|
|
*
|
|
* @...PROMPT command is preprocessed into __AtPrompt() function during
|
|
* compile time.
|
|
* $EXAMPLES$
|
|
* // display a two line menu with status line at the bottom
|
|
* // let the user select favorite day
|
|
* SET MESSAGE TO 24 CENTER
|
|
* @ 10, 2 PROMPT "Sunday" MESSAGE "This is the 1st item"
|
|
* @ 11, 2 PROMPT "Monday" MESSAGE "Now we're on the 2nd item"
|
|
* MENU TO nChoice
|
|
* DO CASE
|
|
* CASE nChoice == 0 // user press Esc key
|
|
* QUIT
|
|
* CASE nChoice == 1 // user select 1st menu item
|
|
* ? "Guess you don't like Mondays"
|
|
* CASE nChoice == 2 // user select 2nd menu item
|
|
* ? "Just another day for some"
|
|
* ENDCASE
|
|
* $STATUS$
|
|
* R
|
|
* $COMPLIANCE$
|
|
* C(menu)
|
|
* $FILES$
|
|
* Library is rtl
|
|
* $SEEALSO$
|
|
* ACHOICE(),MENU TO,SET MESSAGE,SET INTENSITY,SET WRAP,__MENUTO()
|
|
* $END$
|
|
*/
|
|
|
|
/* $DOC$
|
|
* $TEMPLATE$
|
|
* Command
|
|
* $NAME$
|
|
* @...PROMPT
|
|
* $CATEGORY$
|
|
* Command
|
|
* $SUBCATEGORY$
|
|
* User interface
|
|
* $ONELINER$
|
|
* Display a menu item on screen and define a message
|
|
* $SYNTAX$
|
|
* @ <nRow>, <nCol> PROMPT <cPrompt> [MESSAGE <xMsg>]
|
|
* $ARGUMENTS$
|
|
* <nRow> is the row number to display the menu <cPrompt>. Value could
|
|
* range from zero to MAXROW().
|
|
*
|
|
* <nCol> is the column number to display the menu <cPrompt>. Value
|
|
* could range from zero to MAXCOL().
|
|
*
|
|
* <cPrompt> is the menu item character string to display.
|
|
*
|
|
* <xMsg> define a message to display each time this menu item is
|
|
* highlighted. <xMsg> could be a character string or code block that
|
|
* is evaluated to a character string. If <xMsg> is not specified or
|
|
* of the wrong type, an empty string ("") would be used.
|
|
* $DESCRIPTION$
|
|
* With @...Prompt you define and display a menu item, each call to
|
|
* @...Prompt add another item to the menu, to start the menu itself
|
|
* you should call the __MenuTo() function (MENU TO command). You can
|
|
* define any row and column combination and they will be displayed at
|
|
* the order of definition. After each call to @...Prompt, the cursor
|
|
* is placed one column to the right of the last text displayed, and
|
|
* ROW() and COL() are updated.
|
|
*
|
|
* @...PROMPT command is preprocessed into __AtPrompt() function during
|
|
* compile time.
|
|
* $EXAMPLES$
|
|
* // display a two line menu with status line at the bottom
|
|
* // let the user select favorite day
|
|
* SET MESSAGE TO 24 CENTER
|
|
* @ 10, 2 PROMPT "Sunday" MESSAGE "This is the 1st item"
|
|
* @ 11, 2 PROMPT "Monday" MESSAGE "Now we're on the 2nd item"
|
|
* MENU TO nChoice
|
|
* DO CASE
|
|
* CASE nChoice == 0 // user press Esc key
|
|
* QUIT
|
|
* CASE nChoice == 1 // user select 1st menu item
|
|
* ? "Guess you don't like Mondays"
|
|
* CASE nChoice == 2 // user select 2nd menu item
|
|
* ? "Just another day for some"
|
|
* ENDCASE
|
|
* $STATUS$
|
|
* R
|
|
* $COMPLIANCE$
|
|
* C(menu)
|
|
* $SEEALSO$
|
|
* ACHOICE(),MENU TO,SET MESSAGE,SET INTENSITY,SET WRAP,__MENUTO()
|
|
* $END$
|
|
*/
|
|
|
|
/* $DOC$
|
|
* $TEMPLATE$
|
|
* Function
|
|
* $NAME$
|
|
* __MenuTo()
|
|
* $CATEGORY$
|
|
* API
|
|
* $SUBCATEGORY$
|
|
* User interface
|
|
* $ONELINER$
|
|
* Invoked a menu defined by set of @...PROMPT
|
|
* $SYNTAX$
|
|
* __MenuTo( <bBlock>, <cVariable> ) --> nChoice
|
|
* $ARGUMENTS$
|
|
* <bBlock> is a set/get code block for variable named <cVariable>.
|
|
*
|
|
* <cVariable> is a character string that contain the name of the
|
|
* variable to hold the menu choices, if this variable does not exist
|
|
* a PRIVATE variable with the name <cVariable> would be created to
|
|
* hold the result.
|
|
* $RETURNS$
|
|
* __MenuTo() return the number of select menu item, or 0 if there was
|
|
* no item to select from or if the user pressed the Esc key.
|
|
* $DESCRIPTION$
|
|
* __MenuTo() invoked the menu define by previous __AtPrompt() call
|
|
* and display a highlight bar that the user can move to select an
|
|
* option from the menu. If <cVariable> does not exist or not visible,
|
|
* a PRIVATE variable named <cVariable> is created and hold the current
|
|
* menu selection. If there is a variable named <cVariable>, its value
|
|
* is used to select the first highlighted item.
|
|
*
|
|
* Menu prompts and messages are displayed in current Standard color,
|
|
* highlighted bar is displayed using current Enhanced color.
|
|
*
|
|
* Pressing the arrow keys move the highlighted bar. When a menu item
|
|
* is highlighted the message associated with it is displayed on the
|
|
* line specified with SET MESSAGE. If SET WRAP is ON and the user
|
|
* press UP arrow while on the first selection the last menu item is
|
|
* highlighted, if the user press Down arrow while on the last item,
|
|
* the first item is highlighted.
|
|
*
|
|
* Following are active keys that handled by __MenuTo():
|
|
*
|
|
*
|
|
* <table>
|
|
* key Meaning
|
|
*
|
|
* Up Move to previous item
|
|
* Down Move to next item
|
|
* Left Move to previous item
|
|
* Right Move to next item
|
|
* Home Move to the first item
|
|
* End Move to the last item
|
|
* Page-Up Select menu item, return position
|
|
* Page-Down Select menu item, return position
|
|
* Enter Select menu item, return position
|
|
* Esc Abort selection, return 0
|
|
* First letter Select next menu with the same first letter,
|
|
* | return this item position.
|
|
* </table>
|
|
* upon exit the cursor is placed at MAXROW()-1, 0
|
|
* __MenuTo() can be nested without loosing the previous prompts.
|
|
*
|
|
* MENU TO command is preprocessed into __MenuTo() function during
|
|
* compile time.
|
|
* $EXAMPLES$
|
|
* // display menu item on each screen corner and let user select one
|
|
* CLS
|
|
* SET MESSAGE TO MAXROW()/2 CENTER
|
|
* SET WRAP ON
|
|
* @ 0, 0 PROMPT "1. Upper left" MESSAGE " One "
|
|
* @ 0, MAXCOL()-16 PROMPT "2. Upper right" MESSAGE " Two "
|
|
* @ MAXROW()-1,MAXCOL()-16 PROMPT "3. Bottom right" MESSAGE "Three"
|
|
* @ MAXROW()-1,0 PROMPT "4. Bottom left" MESSAGE "Four "
|
|
* MENU TO nChoice
|
|
* SETPOS ( MAXROW()/2, MAXCOL()/2 - 10 )
|
|
* if nChoice == 0
|
|
* ?? "Esc was pressed"
|
|
* else
|
|
* ?? "Selected option is", nChoice
|
|
* endif
|
|
* $STATUS$
|
|
* R
|
|
* $COMPLIANCE$
|
|
* C
|
|
* $FILES$
|
|
* Library is rtl
|
|
* $SEEALSO$
|
|
* @...PROMPT,ACHOICE(),SET MESSAGE,SET INTENSITY,SET WRAP,__ATPROMPT()
|
|
* $END$
|
|
*/
|
|
|
|
/* $DOC$
|
|
* $TEMPLATE$
|
|
* Command
|
|
* $NAME$
|
|
* MENU TO
|
|
* $CATEGORY$
|
|
* API
|
|
* $SUBCATEGORY$
|
|
* User interface
|
|
* $ONELINER$
|
|
* Invoked a menu defined by set of @...PROMPT
|
|
* $SYNTAX$
|
|
* MENU TO <cVariable>
|
|
* $ARGUMENTS$
|
|
* <cVariable> is a character string that contain the name of the
|
|
* variable to hold the menu choices, if this variable does not exist
|
|
* a PRIVATE variable with the name <cVariable> would be created to
|
|
* hold the result.
|
|
* $DESCRIPTION$
|
|
* Menu To() invoked the menu define by previous __AtPrompt() call
|
|
* and display a highlight bar that the user can move to select an
|
|
* option from the menu. If <cVariable> does not exist or not visible,
|
|
* a PRIVATE variable named <cVariable> is created and hold the current
|
|
* menu selection. If there is a variable named <cVariable>, its value
|
|
* is used to select the first highlighted item.
|
|
*
|
|
* Menu prompts and messages are displayed in current Standard color,
|
|
* highlighted bar is displayed using current Enhanced color.
|
|
*
|
|
* Pressing the arrow keys move the highlighted bar. When a menu item
|
|
* is highlighted the message associated with it is displayed on the
|
|
* line specified with SET MESSAGE. If SET WRAP is ON and the user
|
|
* press UP arrow while on the first selection the last menu item is
|
|
* highlighted, if the user press Down arrow while on the last item,
|
|
* the first item is highlighted.
|
|
*
|
|
* Following are active keys that handled by Menu To:
|
|
*
|
|
* <table>
|
|
* key Meaning
|
|
*
|
|
* Up - Move to previous item
|
|
* Down - Move to next item
|
|
* Left - Move to previous item
|
|
* Right - Move to next item
|
|
* Home - Move to the first item
|
|
* End - Move to the last item
|
|
* Page-Up - Select menu item, return position
|
|
* Page-Down - Select menu item, return position
|
|
* Enter - Select menu item, return position
|
|
* Esc - Abort selection, return 0
|
|
* First letter - Select next menu with the same first letter,
|
|
* | return this item position.
|
|
* </table>
|
|
* upon exit the cursor is placed at MAXROW()-1, 0
|
|
* Menu To can be nested without loosing the previous prompts.
|
|
*
|
|
* MENU TO command is preprocessed into __MenuTo() function during
|
|
* compile time.
|
|
* $EXAMPLES$
|
|
* // display menu item on each screen corner and let user select one
|
|
* CLS
|
|
* SET MESSAGE TO MAXROW()/2 CENTER
|
|
* SET WRAP ON
|
|
* @ 0, 0 PROMPT "1. Upper left" MESSAGE " One "
|
|
* @ 0, MAXCOL()-16 PROMPT "2. Upper right" MESSAGE " Two "
|
|
* @ MAXROW()-1,MAXCOL()-16 PROMPT "3. Bottom right" MESSAGE "Three"
|
|
* @ MAXROW()-1,0 PROMPT "4. Bottom left" MESSAGE "Four "
|
|
* MENU TO nChoice
|
|
* SETPOS ( MAXROW()/2, MAXCOL()/2 - 10 )
|
|
* if nChoice == 0
|
|
* ?? "Esc was pressed"
|
|
* else
|
|
* ?? "Selected option is", nChoice
|
|
* endif
|
|
* $STATUS$
|
|
* R
|
|
* $COMPLIANCE$
|
|
* C
|
|
* $SEEALSO$
|
|
* @...PROMPT,ACHOICE(),SET MESSAGE,SET INTENSITY,SET WRAP,__ATPROMPT()
|
|
* $END$
|
|
*/
|