Ray Carson's Tagmenu

 BBS: Inland Empire Archive
Date: 07-05-92 (03:52)             Number: 110
From: BILL CAMPBELL                Refer#: NONE
  To: DOUGLAS LUSHER                Recvd: NO  
Subj: Ray Carson's Tagmenu           Conf: (2) Quik_Bas
REM Ray Carson's TagMenu

REM The selection box can be located anywhere on the screen
between rows REM 2 and 24 and can be any size. To locate
change the values of UpperRow,REM LowerRow, and LeftColumn.
Long lines were broken with an underscore.

DEFINT A-Z
DECLARE SUB TagMenu (upperrow, lowerrow, LeftColumn,
FgNormal, BgNormal, FgHlight, BgHlight, FgMarker, Keycode,
n, QtySe lected, array$(), Tagged())
REDIM array$(50), Tagged(50)

COLOR 0, 3: CLS
DEF SEG = &HB800
FOR x = 0 TO 4000 STEP 2
    POKE x, 176
NEXT
DEF SEG
FOR x = 1 TO 50
    array$(x) = "Item No." + STR$(x)
NEXT
n = 50
CALL TagMenu(5, 20, 32, 15, 1, 4, 7, 4, Keycode, n,
QtySelected, array$(), Tagged())

COLOR 7, 0: CLS
IF Keycode = 27 THEN PRINT "User Aborted": END
PRINT LTRIM$(STR$(QtySelected)); " items selected:"
FOR x = 1 TO n
    IF Tagged(x) THEN
        LOCATE , 5
        PRINT array$(x)
    END IF
NEXT
END

SUB TagMenu (upperrow, lowerrow, LeftColumn, FgNormal,
BgNormal, FgHlight, BgHlight, FgMarker, Keycode, n,
QtySelected, array$(), Tagged())

    SelChr$ = CHR$(16)
    maxlength = 0
    FOR x = 1 TO n
        Q = LEN(array$(x))
        IF Q > maxlength THEN maxlength = Q
    NEXT
    COLOR FgNormal, BgNormal
    LOCATE 24, 6: PRINT SPACE$(68);
    LOCATE 24, 7
    PRINT "<Home, End, "; CHR$(25); ", "; CHR$(24); ", Page
Up/Down>           <Spacebar>Mark/Clear";
    LOCATE 25, 6: PRINT SPACE$(68);
    LOCATE 25, 7
    PRINT "<F2>Mark All     <F3>Clear All         <Esc>Abort      <Return>Go";
    UR = upperrow - 1
    LR = lowerrow + 1
    LC = LeftColumn - 2
    RC = LeftColumn + maxlength + 3
    Top$ = CHR$(218) + STRING$(((RC - 1) - LC), 196) + CHR$(191)
    Middle$ = CHR$(179) + STRING$(((RC - 1) - LC), 32) + CHR$(179)
    Bottom$ = CHR$(192) + STRING$(((RC - 1) - LC), 196) + CHR$(217)
    LOCATE UR, LC: PRINT Top$;
    FOR Q = UR + 1 TO LR - 1
        LOCATE Q, LC: PRINT Middle$;
    NEXT
    LOCATE LR, LC: PRINT Bottom$;
setuptagmenu:
    row = upperrow: Column = LeftColumn
    COLOR FgNormal, BgNormal
    x = 1
    DO
        LOCATE row, Column
        PRINT " " + array$(x) + SPACE$(maxlength - LEN(array$(x))) + " ";
        RowI = row
        GOSUB CheckTagged
        row = row + 1
        IF row = lowerrow + 1 THEN EXIT DO
        x = x + 1
    LOOP UNTIL x > n
    row = upperrow
    x = 1
    COLOR FgHlight, BgHlight
    LOCATE row, Column
    PRINT " " + array$(x) + SPACE$(maxlength - LEN(array$(x))) + " ";

GetKey:
    DO
        k$ = INKEY$
    LOOP UNTIL LEN(k$)
    Keycode = ASC(k$)
    IF LEN(k$) = 2 THEN Keycode = ASC(RIGHT$(k$, 1))
    IF Keycode = 13 OR Keycode = 27 THEN    'Return or Escape
        COLOR FgNormal, BgNormal
        LOCATE row, Column
        PRINT " " + array$(x) + SPACE$(maxlength - LEN(array$(x))) + " ";
        COLOR 7, 0
        EXIT SUB
    END IF

--- Maximus 2.00
 * Origin: Durham Systems (ONLINE!) (1:229/110)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET