* contrib/hbformat/hbfmtcls.prg
* new TOFIX:
".T.," / ".F.," gets wrongly corrected to ".T. ," / ".F. ,"
* contrib/hbct/tests/atrepl.prg
* contrib/hbct/tests/ctwtest.prg
* contrib/hbct/tests/datetime.prg
* contrib/hbgd/gdbar.prg
* contrib/hbgd/gdbarcod.prg
* contrib/hbgd/tests/barms.prg
* contrib/hbgd/tests/bartest.prg
* contrib/hbgd/tests/gdtestcl.prg
* contrib/hbgd/tests/test_out.prg
* contrib/hbhpdf/tests/harupdf.prg
* contrib/hbmisc/fcomma.prg
* contrib/hbnf/calendar.prg
* contrib/hbnf/dispmsg.prg
* contrib/hbnf/floptst.prg
* contrib/hbnf/ftround.prg
* contrib/hbnf/mouse1.prg
* contrib/hbnf/pegs.prg
* contrib/hbnf/popadder.prg
* contrib/hbnf/tempfile.prg
* contrib/hbnf/tests/aading.prg
* contrib/hbnf/tests/calendar.prg
* contrib/hbnf/tests/clrsel.prg
* contrib/hbnf/tests/dispmsg.prg
* contrib/hbnf/tests/findith.prg
* contrib/hbnf/tests/menu1.prg
* contrib/hbnf/tests/tbwhile.prg
* contrib/hbnf/tests/vertmenu.prg
* contrib/hbsqlit3/tests/authoriz.prg
* contrib/hbsqlit3/tests/backup.prg
* contrib/hbsqlit3/tests/hooks.prg
* contrib/hbsqlit3/tests/metadata.prg
* contrib/hbsqlit3/tests/pack.prg
* contrib/hbsqlit3/tests/sl3_test.prg
* contrib/hbtip/sendmail.prg
* contrib/hbtip/tests/base64.prg
* contrib/hbtip/tests/httpadv.prg
* contrib/hbtip/thtml.prg
* contrib/hbtpathy/telepath.prg
* contrib/hbwin/tests/testole.prg
* contrib/rddads/tests/datad.prg
* contrib/rddads/tests/testmg.prg
* contrib/rddsql/tests/arrayrdd.prg
* contrib/sddmy/tests/test1.prg
* contrib/sddoci/tests/test1.prg
* contrib/sddodbc/tests/test1.prg
* contrib/sddodbc/tests/test2.prg
* contrib/sddsqlt3/tests/test1.prg
* contrib/xhb/dumpvar.prg
* contrib/xhb/hblog.prg
* contrib/xhb/trpc.prg
* contrib/xhb/trpccli.prg
* contrib/xhb/ttable.prg
* contrib/xhb/xcstr.prg
* contrib/xhb/xhberr.prg
* contrib/xhb/xhbtedit.prg
* extras/gtwvw/tests/cbtest6.prg
* extras/gtwvw/tests/drawimg.prg
* extras/gtwvw/tests/ebtest7.prg
* extras/gtwvw/tests/maximize.prg
* extras/gtwvw/tests/prog0.prg
* extras/gtwvw/tests/prog1.prg
* extras/gtwvw/tests/prog2.prg
* extras/gtwvw/tests/wvwtest9.prg
* extras/hbvpdf/hbvpdf.prg
* extras/hbvpdf/tests/pdf_demo.prg
* extras/httpsrv/modules/info.prg
* extras/httpsrv/modules/showcounter.prg
* tests/ac_test2.prg
* tests/adirtest.prg
* tests/and_or.prg
* tests/brwpos.prg
* tests/clasname.prg
* tests/extend1.prg
* tests/newrdd.prg
* tests/testbrw.prg
* tests/testcdx.prg
* tests/testdbf.prg
* tests/transtst.prg
* tests/tstasort.prg
* tests/usrrdd/exarr.prg
* tests/usrrdd/exhsx.prg
* formatting (mostly fixing one formatting error by hbformat)
133 lines
3.0 KiB
Plaintext
133 lines
3.0 KiB
Plaintext
/*
|
|
* $Id$
|
|
*/
|
|
|
|
/*
|
|
* Harbour Project source code:
|
|
* ACHOICE() test
|
|
*
|
|
* Copyright 2009 Vladislav Lavrecky <lavr / at / ldz.lv>
|
|
* www - http://harbour-project.org
|
|
*
|
|
*/
|
|
|
|
/*
|
|
* Menu Navigation - Right and Left arrows keys, ESC to exit
|
|
* After some Right or Left arrows preses
|
|
* in Harbour app all menu items are highlighted
|
|
* an no way to understand which element is current,
|
|
* with clipper app all is ok.
|
|
*/
|
|
#include "inkey.ch"
|
|
#include "achoice.ch"
|
|
|
|
MEMVAR lHiLiTest
|
|
|
|
PROCEDURE Main()
|
|
|
|
// NIL, empty, numeric, and "not handled" - items
|
|
// must be inaccesible and invisible
|
|
LOCAL aMenu1 := { " --Visky--", "", "not handled" }
|
|
LOCAL aMenu2 := { " --Vodka--", " --Water--", NIL, "not handled" }
|
|
LOCAL aMenu3 := { " --Grapa--", 33, "not handled" }
|
|
|
|
// for AC_NOITEM mode test
|
|
LOCAL aMenu4 := { "", "not handled" }
|
|
|
|
|
|
LOCAL lExit := .F.
|
|
LOCAL nCounter := 1
|
|
LOCAL nKeyPressed
|
|
|
|
// set to True for items (de)highlighting
|
|
// algoritm in clipper
|
|
PUBLIC lHiLiTest := .F.
|
|
|
|
|
|
SetColor( "W+/N, BG+/B, , , W/N" )
|
|
cls
|
|
@ 2, 1 SAY " --Visky-- --Vodka-- --Grapa--"
|
|
@ 3, 14 SAY "--Water--"
|
|
DO WHILE !lExit
|
|
|
|
DO CASE
|
|
CASE nCounter == 1
|
|
AChoice( 2, 1, 3, 11, aMenu1 )
|
|
CASE nCounter == 2
|
|
AChoice( 2, 13, 3, 23, aMenu2, .T., "cUF" )
|
|
CASE nCounter == 3
|
|
AChoice( 2, 25, 3, 35, aMenu3, .T. )
|
|
CASE nCounter == 4
|
|
// User function cUF2() fill screen with exclamation marks
|
|
// in clipper it does not get called in AC_NOITEM mode
|
|
AChoice( 2, 37, 3, 47, aMenu4, .T., "cUF2" )
|
|
|
|
ENDCASE
|
|
|
|
nKeyPressed := LastKey()
|
|
IF nKeyPressed == K_ESC
|
|
lExit := .T.
|
|
ELSEIF nKeyPressed == K_RIGHT
|
|
nCounter := iif( nCounter == 4, 1, nCounter + 1 )
|
|
ELSEIF nKeyPressed == K_LEFT
|
|
nCounter := iif( nCounter == 1, 4, nCounter - 1 )
|
|
ENDIF
|
|
|
|
ENDDO
|
|
|
|
RETURN
|
|
|
|
// Test for current and previous items
|
|
// highliting-dehighliting algoritm
|
|
|
|
FUNCTION cUF( nMode, nCurElement, nRowPos )
|
|
|
|
LOCAL nRetVal := AC_CONT
|
|
LOCAL nKey := LastKey()
|
|
|
|
HB_SYMBOL_UNUSED( nCurElement )
|
|
HB_SYMBOL_UNUSED( nRowPos )
|
|
|
|
IF lHiLiTest
|
|
DispBox( 0, 0, MaxRow(), MaxCol(), Replicate( "#", 9 ), "GR+/G" )
|
|
ENDIF
|
|
|
|
IF nMode == AC_NOITEM
|
|
nRetVal := AC_ABORT
|
|
ELSEIF nMode == AC_EXCEPT
|
|
DO CASE
|
|
CASE nKey == K_RETURN
|
|
nRetVal := AC_SELECT
|
|
OTHERWISE
|
|
nRetVal := AC_ABORT
|
|
ENDCASE
|
|
ENDIF
|
|
|
|
RETURN nRetVal
|
|
|
|
// test for AC_NOITEM mode
|
|
// Clipper in AC_NOITEM mode do not call User Function
|
|
|
|
FUNCTION cUF2( nMode, nCurElement, nRowPos )
|
|
|
|
LOCAL nRetVal := AC_CONT
|
|
LOCAL nKey := LastKey()
|
|
|
|
HB_SYMBOL_UNUSED( nCurElement )
|
|
HB_SYMBOL_UNUSED( nRowPos )
|
|
|
|
DispBox( 0, 0, MaxRow(), MaxCol(), Replicate( "!", 9 ), "GR+/G" )
|
|
|
|
IF nMode == AC_NOITEM
|
|
nRetVal := AC_ABORT
|
|
ELSEIF nMode == AC_EXCEPT
|
|
DO CASE
|
|
CASE nKey == K_RETURN
|
|
nRetVal := AC_SELECT
|
|
OTHERWISE
|
|
nRetVal := AC_ABORT
|
|
ENDCASE
|
|
ENDIF
|
|
|
|
RETURN nRetVal
|