From 1d72d0aa85d5de3523f27243d9e381435632356f Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 20 Dec 1999 17:47:52 +0000 Subject: [PATCH] 19991220-18:42 GMT+1 --- harbour/ChangeLog | 8 ++ harbour/source/rtl/menuto.prg | 167 +++++++++++++++++++++++++++++++++- harbour/tests/Makefile | 166 ++++++--------------------------- 3 files changed, 199 insertions(+), 142 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index eacd83c76f..8e34c1fa50 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,11 @@ +19991220-18:42 GMT+1 Chen Kedem + * source/rtl/menuto.prg + + doc for __AtPrompt() + + doc for __MenuTo() + I'm looking at v1.14 and the following are wrong: + ! __AtPrompt() : nCol <--> nRow (switch names, not places) + (Uploaded by Victor Szel) + Mon Dec 20 13:49:01 1999 Gonzalo A. Diethelm * source/rdd/dbcmd.c: diff --git a/harbour/source/rtl/menuto.prg b/harbour/source/rtl/menuto.prg index cdba34b1d7..feaa46d674 100644 --- a/harbour/source/rtl/menuto.prg +++ b/harbour/source/rtl/menuto.prg @@ -18,6 +18,10 @@ * Copyright 1999 Victor Szel * Changes for higher Clipper compatibility * + * Copyright 1999 Chen Kedem + * __ATPROMPT() documentation + * __MENUTO() documentation + * * See doc/license.txt for licensing terms. * */ @@ -33,7 +37,74 @@ static s_aLevel := {} static s_nPointer := 1 -function __AtPrompt( nCol, nRow, cPrompt, cMsg ) +/* $DOC$ + * $FUNCNAME$ + * __AtPrompt() (@...PROMPT command) + * $CATEGORY$ + * Data input and output + * $ONELINER$ + * Display a menu item on screen and define a message + * $SYNTAX$ + * __AtPrompt( , , , [] ) --> .F. + * + * or + * + * @ , PROMPT [MESSAGE ] + * $ARGUMENTS$ + * is the row number to display the menu . Value could + * range from zero to MAXROW(). + * + * is the column number to display the menu . Value + * could range from zero to MAXCOL(). + * + * is the menu item character string to display. + * + * define a message to display each time this menu item is + * highlighted. could be a character string or code block that + * is evaluated to a character string. If is not specified or + * got 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 + * $TESTS$ + * $STATUS$ + * $COMPLIANCE$ + * CA-Clipper array is limited to 4096 items, and therefor 4096 menu + * items are the maximum that could be defined per one menu, Harbour + * does not have this limit (not that you'll ever need that). + * $PLATFORMS$ + * $FILES$ + * $SEEALSO$ + * ACHOICE(), MENU TO, SET MESSAGE, SET INTENSITY, SET WRAP, __MenuTo() + * $END$ + */ + +function __AtPrompt( nRow, nCol, cPrompt, cMsg ) if s_nPointer < 1 s_nPointer := 1 @@ -45,13 +116,103 @@ function __AtPrompt( nCol, nRow, cPrompt, cMsg ) enddo // add to the static array - aadd( s_aLevel[ s_nPointer ], { nCol, nRow, cPrompt, cMsg } ) + aadd( s_aLevel[ s_nPointer ], { nRow, nCol, cPrompt, cMsg } ) // put this prompt on the screen right now - DispOutAt( nCol, nRow, cPrompt ) + DispOutAt( nRow, nCol, cPrompt ) return .f. +/* $DOC$ + * $FUNCNAME$ + * __MenuTo() (MENU TO command) + * $CATEGORY$ + * Data input and output + * $ONELINER$ + * Invoked a menu defined by set of @...PROMPT + * $SYNTAX$ + * __MenuTo( , ) --> nChoice + * + * or + * + * MENU TO + * $ARGUMENTS$ + * is a set/get code block for variable named . + * + * 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 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 does not exist or not visible, + * a PRIVATE variable named is created and hold the current + * menu selection. If there is a variable named , 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(): + * ----------------------------------------------------- + * + * 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. + * + * 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 + * $TESTS$ + * $STATUS$ + * $COMPLIANCE$ + * + * $PLATFORMS$ + * $FILES$ + * $SEEALSO$ + * @...PROMPT, ACHOICE(), SET MESSAGE, SET INTENSITY, SET WRAP, + * __AtPrompt() + * $END$ + */ + function __MenuTo( bBlock, cVariable ) local nKey diff --git a/harbour/tests/Makefile b/harbour/tests/Makefile index beeecce836..4bbf31c736 100644 --- a/harbour/tests/Makefile +++ b/harbour/tests/Makefile @@ -2,167 +2,62 @@ # $Id$ # -ifeq ($(HB_MAIN),) -HB_MAIN = std -endif - ROOT = ../ LIBS=\ - tools \ - debug \ - rtl \ + tools \ + debug \ + rtl \ rdd \ vm \ rdd \ rtl \ macro \ pp \ - runner \ + runner \ common \ ifeq ($(PM),) PM := $(pm) endif +ifeq ($(PM),) # PM not defined = build all files -ifeq ($(PM),) # PM not defined = build all files +DIRS=\ + regress \ + +include $(TOP)$(ROOT)config/dir.cf PRG_SOURCES=\ - ac_test.prg \ - adirtest.prg \ - ainstest.prg \ - and_or.prg \ - array16.prg \ - arrayidx.prg \ - arrays.prg \ - arreval.prg \ - arrindex.prg \ - atest.prg \ - begin.prg \ - box.prg \ - boxtest.prg \ - byref.prg \ - calling.prg \ - cdow.prg \ - clasinit.prg \ - classch.prg \ - classes.prg \ - clsdata.prg \ - cmphello.prg \ - codebl.prg \ - codebloc.prg \ - comments.prg \ - curdirt.prg \ - cursrtst.prg \ - dates.prg \ - dates2.prg \ - dates3.prg \ - dates4.prg \ - db_brows.prg \ - dbevalts.prg \ - debugtst.prg \ - devtest.prg \ - dirtest.prg \ - disptest.prg \ - docase.prg \ - dosshell.prg \ - dynobj.prg \ - dynsym.prg \ - exittest.prg \ - fib.prg \ - fornext.prg \ - fortest.prg \ - fsplit.prg \ - funcarr.prg \ - hello.prg \ - ifelse.prg \ - ifinline.prg \ - inherit.prg \ - inifiles.prg \ - initexit.prg \ - inkeytst.prg \ - inline.prg \ - iotest.prg \ - iotest2.prg \ - longdev.prg \ - longstr.prg \ - longstr2.prg \ - mathtest.prg \ - memfile.prg \ - memory.prg \ - memvar.prg \ - menutest.prg \ - multiarg.prg \ - nums.prg \ - objarr.prg \ - objasign.prg \ - objects.prg \ - os.prg \ - output.prg \ - overload.prg \ - parexpr.prg \ - passref.prg \ - procline.prg \ - procname.prg \ - readfile.prg \ - readhrb.prg \ - recursiv.prg \ - returns.prg \ - round.prg \ - rtfclass.prg \ - say.prg \ - scroll.prg \ - seconds.prg \ - set_num.prg \ - set_test.prg \ - sound.prg \ - statinit.prg \ - statfun.prg \ - statics.prg \ - strdelim.prg \ - strip.prg \ - t1.prg \ - test.prg \ - test_all.prg \ - testbrdb.prg \ - testbrw.prg \ - testcgi.prg \ - testdbf.prg \ - testerro.prg \ - testfor.prg \ - testgt.prg \ - testhbf.prg \ - testhtml.prg \ - testinc.prg \ - testmem.prg \ - teststr.prg \ - testtok.prg \ - testpre.prg \ - testread.prg \ - testrdd.prg \ - testvars.prg \ - testwarn.prg \ - tstalias.prg \ - tstcolor.prg \ - tstprag.prg \ - version.prg \ - while.prg \ +a.prg \ + +#memory.prg \ +#testbrdb.prg \ +#tstmacro.prg \ +#debugtst.prg \ +#dynsym.prg \ +#debugtst.prg \ +#memfile.prg \ +#adirtest.prg \ +#overload.prg \ +#statinit.prg \ +#ac_test.prg \ +#fortest.prg \ +#and_or.prg \ +#inkeytst.prg \ +#testrdd.prg \ +#testdbf.prg \ PRG_HEADERS=\ - db_brows.ch \ cgi.ch \ keywords.ch \ test.ch \ BAD_PRG_SOURCES=\ alias.prg \ - clasname.prg \ dupvars.prg \ extend1.prg \ keywords.prg \ linecont.prg \ - lnlenli1.prg \ - lnlenli2.prg \ setkeys.prg \ spawn.prg \ spawn2.prg \ @@ -170,7 +65,6 @@ BAD_PRG_SOURCES=\ statics2.prg \ test10.prg \ testid.prg \ - vec1.prg \ C_SOURCES=\ @@ -181,11 +75,6 @@ BAD_C_SOURCES=\ include $(TOP)$(ROOT)config/test.cf -DIRS=\ - regress \ - -include $(TOP)$(ROOT)config/dir.cf - else #PM defined = build specified file ifneq ($(findstring .prg,$(PM)),) @@ -200,4 +89,3 @@ endif include $(TOP)$(ROOT)config/bin.cf endif -