Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : TN8904.ZIP
Filename : MATRIX.ASC

 
Output of file : MATRIX.ASC contained in archive : TN8904.ZIP
Matrix.PRG

* Program...: Matrix
* Author....: Richard Bunter
* Date......: March 1, 1989
* Versions..: dBASE IV v1.0
* Note(s)...: This program simulates a "two-dimensional" menu bar.

SET TALK OFF

*--- Declare the array and load in the menu choices.
DECLARE Menu[4,3]
Menu[1,1] = " Holidays "
Menu[2,1] = " Special of the Day "
Menu[3,1] = " Admin Reports "
Menu[4,1] = " Take a Nap "
Menu[1,2] = " Purge Marked Records "
Menu[2,2] = " Unlock Locked Records"
Menu[3,2] = " Rebuild Indexes "
Menu[4,2] = " Send a Message "
Menu[1,3] = " Edit Defaults "
Menu[2,3] = " Credits "
Menu[3,3] = " Initialize Files "
Menu[4,3] = " Security Stuff "

ln_cols = 3 && Number of columns.
ln_rows = 4 && Number of rows.
ln_width = 24 && Number of characters between columns.

ll_Loop = .T.
DO WHILE ll_Loop
CLEAR

*--- Draw boxes and menu headers.
@ 7, 3 TO 14,26
@ 8, 4 SAY " The Usual "
@ 9, 3 SAY CHR(198) + REPL(CHR(205),22) + CHR(181)
@ 7,27 TO 14,50
@ 8,28 SAY " The Not-So-Usual "
@ 9,27 SAY CHR(198) + REPL(CHR(205),22) + CHR(181)
@ 7,51 TO 14,74
@ 8,52 SAY " The Bizarre "
@ 9,51 SAY CHR(198) + REPL(CHR(205),22) + CHR(181)


*--- Put the choices on the screen.
ln_row = 1
ln_col = 1
DO WHILE ln_col <= ln_cols
ln_row = 1
DO WHILE ln_row <= ln_rows
@ 9 +ln_row,ln_rows + (ln_width * (ln_col -1)) ;
SAY Menu[ln_row, ln_col]
ln_row = ln_row +1
ENDDO
ln_col = ln_col +1
ENDDO



*--- Tell the user how to work it.
@ 23,10 SAY "Use the arrow keys to highlight an option then press Return"
@ 24,20 SAY "Press Escape to return to the Main Menu"

*--- Reset row and column variables to 1.
ln_row = 1
ln_col = 1

*--- Get the keystroke.
DO WHILE .T.
*--- Highlight the current selection.
@ 9 +ln_row, ln_rows + (ln_width * (ln_col -1)) ;
GET Menu[ln_row, ln_col]
CLEAR GETS

*--- Turn the cursor off.
SET INTENSITY OFF

*--- GET a dummy variable.
ans = " "
@ 23,79 GET ans PICT "!"
READ

*--- Turn the cursor on again.
SET INTENSITY ON
key = LASTKEY()

*--- Dim the selection.
@ 9 +ln_row, ln_rows + (ln_width * (ln_col -1)) ;
SAY Menu[ln_row, ln_col]

*--- Evaluate keystroke.
DO CASE
CASE key = 27 .OR. key = 13 && Escape or Return.
EXIT

CASE key = 24 && Down arrow.
ln_row = ln_row +1

CASE key = 4 && Right arrow.
ln_col = ln_col +1

CASE key = 19 && Left arrow.
ln_col = ln_col -1

CASE key = 5 && Up arrow.
ln_row = ln_row -1

ENDCASE

*--- Adjust if necessary.
DO CASE
CASE ln_row < 1
*--- Went above the top choice so go to the bottom of
* the next column.
ln_row = ln_rows
ln_col = MOD((ln_col -1), ln_cols)
ln_col = IIF(ln_col = 0, ln_cols, ln_col)

CASE ln_row > ln_rows
*--- Went below the bottom choice so go to the top of
* next column.
ln_row = 1
ln_col = MOD((ln_col +1), ln_cols)
ln_col = IIF(ln_col=0, ln_cols, ln_col)

CASE ln_col < 1
*--- Went to the left of the left-most column so go
* up one row and to the right-most column.
ln_col = ln_cols
ln_row = MOD((ln_row -1), ln_rows)
ln_row = IIF(ln_row = 0, ln_rows, ln_row)

CASE ln_col > ln_cols
*--- Went to the right of the right-most column so
* go down one row and to the left-most column.
ln_col = 1
ln_row = MOD((ln_row +1), ln_rows)
ln_row = IIF(ln_row = 0, ln_rows, ln_row)

ENDCASE

ENDDO

*--- Whether we got here by Escape or Return,
* store the selection.
ln_Selection = ln_row + ((ln_col -1) * ln_rows)

*--- Take action.
DO CASE
CASE key = 27 && Escape.
EXIT

CASE ln_Selection = 1 && Row 1, Column 1 (Holidays).
* DO Whatever.

* more cases...

ENDCASE

ENDDO
RETURN
* EOP: Matrix

v


  3 Responses to “Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : TN8904.ZIP
Filename : MATRIX.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/