home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_BAS
/
DNALIB59.ZIP
/
LOTUS.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-02-14
|
8KB
|
348 lines
DECLARE SUB Browse(FileName$,Mouse%,TextColor%,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Attr%,Shadow%,Border%)
DECLARE SUB CalcByte(Attr%,LowByte%,HiByte%)
DECLARE SUB Clicked(Rgt%,Lft%,Row%,Col%)
DECLARE SUB HideCursor()
DECLARE SUB ShowCursor()
DECLARE SUB SplitPath(FilePath$, Path$, FileName$)
DECLARE FUNCTION LeftButtonReleased%()
DECLARE FUNCTION GetProgramName$()
DECLARE FUNCTION GetPSP%()
SUB Lotus(Choices$(),Infoline$(),HiLight%,Mouse%,LPointer%,HotKey%,HelpTextColor%,HelpAttr%,BarAttr%,HiAttr%,MenuRow%,Gap%) PUBLIC
CalcByte HiAttr%,HiFG%,HiBG%
CalcByte BarAttr%,BarFG%,BarBG%
SplitPath GetProgramName$,Home$,EXEName$
'first we initialize these to zero
i% = 0
j% = 0
Maxlength% = 0
'next we count the choices and set the result to count%
DO
INCR i%
INCR j%
IF LEN(Choices$(i%)) = 0 THEN
DECR i%
ELSE
Fixedup$ = REMOVE$(Choices$(i%),"@")
Maxlength% = Maxlength% + LEN(Fixedup$)
END IF
LOOP WHILE i% = j%
Count% = i%
DIM Position%(1 TO Count%)
'here we do a bit of checking to see if the menu bar will fit
IF Maxlength% + ((Gap% * Count%) + Gap%) > 80 THEN
COLOR 0,7
LOCATE 12,27,0
PRINT "Horizontal Menu is too big";
EXIT SUB
END IF
IF LPointer% = -1 THEN
LOCATE MenuRow%,1,0
COLOR BarFG%,BarBG%
PRINT SPACE$(80);
Pointer% = 0
LPointer% = 0
SelectionMade% = 1
ELSE
Pointer% = LPointer%
SelectionMade% = 0
END IF
Jump:
DO
GOSUB PrintRoutine
IF SelectionMade% THEN
IF InfoLinePrinted% THEN
COLOR BarFG%,BarBG%
LOCATE MenuRow% + 1,1,0
PRINT SPACE$(80);
END IF
EXIT SUB
END IF
WHILE NOT INSTAT
IF Mouse% THEN
Rgt% = 0:Lft% = 0:MRow% = 0:MCol% = 0
ShowCursor
Clicked Rgt%,Lft%,MRow%,MCol%
IF Lft% AND MRow% = MenuRow% THEN
FOR i% = 1 TO Count%
IF MCol% >= Position%(i%) AND MCol% < Position%(i%) + LEN(REMOVE$(Choices$(i%),"@")) THEN
Pointer% = i%
IF LeftButtonReleased THEN
SelectionMade% = 1
LPointer% = Pointer%
Pointer% = 0: HiLight% = 0
ELSE
SelectionMade% = 0
END IF
GOTO Jump
END IF
NEXT i%
ELSE
IF LeftButtonReleased THEN
SelectionMade% = 1
LPointer% = 0
Pointer% = 0: HiLight% = 0
GOTO Jump
END IF
END IF
END IF
WEND
Ky$ = INKEY$
IF LEN(Ky$) = 1 THEN
Chose% = ASC(Ky$)
ELSE
Chose% = -ASC(RIGHT$(Ky$,1))
END IF
SELECT CASE Chose%
CASE -16
TestKey$ = "Q"
GOSUB AltKeys
CASE -17
TestKey$ = "W"
GOSUB AltKeys
CASE -18
TestKey$ = "E"
GOSUB AltKeys
CASE -19
TestKey$ = "R"
GOSUB AltKeys
CASE -20
TestKey$ = "T"
GOSUB AltKeys
CASE -21
TestKey$ = "Y"
GOSUB AltKeys
CASE -22
TestKey$ = "U"
GOSUB AltKeys
CASE -23
TestKey$ = "I"
GOSUB AltKeys
CASE -24
TestKey$ = "O"
GOSUB AltKeys
CASE -25
TestKey$ = "P"
GOSUB AltKeys
CASE -30
TestKey$ = "A"
GOSUB AltKeys
CASE -31
TestKey$ = "S"
GOSUB AltKeys
CASE -32
TestKey$ = "D"
GOSUB AltKeys
CASE -33
TestKey$ = "F"
GOSUB AltKeys
CASE -34
TestKey$ = "G"
GOSUB AltKeys
CASE -35
TestKey$ = "H"
GOSUB AltKeys
CASE -36
TestKey$ = "J"
GOSUB AltKeys
CASE -37
TestKey$ = "K"
GOSUB AltKeys
CASE -38
TestKey$ = "L"
GOSUB AltKeys
CASE -44
TestKey$ = "Z"
GOSUB AltKeys
CASE -45
TestKey$ = "X"
GOSUB AltKeys
CASE -46
TestKey$ = "C"
GOSUB AltKeys
CASE -47
TestKey$ = "V"
GOSUB AltKeys
CASE -48
TestKey$ = "B"
GOSUB AltKeys
CASE -49
TestKey$ = "N"
GOSUB AltKeys
CASE -50
TestKey$ = "M"
GOSUB AltKeys
CASE -59 ' F1 Help key
IF Pointer% > 0 THEN
IF LEN(REMOVE$(Choices$(Pointer%),ANY "@ ")) > 8 THEN
FileName$ = LEFT$(UCASE$(REMOVE$(Choices$(Pointer%),ANY "@ ")),8) + ".HLP"
ELSE
FileName$ = UCASE$(REMOVE$(Choices$(Pointer%),ANY "@ ")) + ".HLP"
END IF
BROWSE Home$ + FileName$,Mouse%,HelpTextColor%,7,16,18,64,HelpAttr%,1,1
END IF
CASE -75 'left arrow
IF Pointer% THEN
IF Pointer% > 1 THEN 'if Pointer is greater than Count
DECR Pointer%
ELSE
Pointer% = Count%
END IF
ELSE
Pointer% = Count%
END IF
CASE -77 'right arrow
IF Pointer% THEN
IF Pointer% < Count% THEN 'if Pointer is greater than Count
INCR Pointer%
ELSE
Pointer% = 1
END IF
ELSE
Pointer% = 1
END IF
CASE 13 'enter key
IF Pointer% THEN
SelectionMade% = 1
LPointer% = Pointer%
Pointer% = 0: HiLight% = 0
GOTO Jump
END IF
CASE 65 TO 90,97 TO 122
TestKey$ = UCASE$(Ky$)
GOSUB AltKeys
CASE 27 'Esc key
SelectionMade% = 1
LPointer% = 0
Pointer% = 0: HiLight% = 0
GOTO Jump
CASE ELSE
SelectionMade% = 1
LPointer% = 0
Pointer% = 0: HiLight% = 0
BEEP
GOTO Jump
END SELECT
LOOP
EXIT SUB
'----------------------------------------------------------------------------
AltKeys:
LPointer% = 0
FOR m% = 1 TO Count%
IF INSTR(Choices$(m%),"@") > 0 THEN
HotKeyPos% = INSTR(Choices$(m%),"@")
HotKey$ = UCASE$(MID$(Choices$(m%),(HotKeyPos% + 1),1))
IF HotKey$ = TestKey$ THEN
LPointer% = m%
Pointer% = 0: HiLight% = 0
SelectionMade% = 1
END IF
END IF
NEXT m%
IF LPointer% = 0 THEN
Pointer% = 0: HiLight% = 0
SelectionMade% = 1
BEEP
END IF
RETURN
'----------------------------------------------------------------------------
PrintRoutine:
IF HiLight% THEN
OnOff% = Hotkey%
ELSE
OnOff% = BarFG%
END IF
IF Mouse% THEN HideCursor
FOR k% = 1 TO Count% 'this looks for the pointer
IF k% = Pointer% THEN 'and calculates the column
IF k% > 1 THEN 'to start printing the hi lite
Total% = 0
FOR l% = 1 TO (k% - 1)
INCR Total%,(Gap%)
Fixedup$ = REMOVE$(Choices$(l%),"@")
Total% = Total% + LEN(Fixedup$)
NEXT l%
Colpos% = Total% + (Gap% + 1)
ELSE
Colpos% = Gap% + 1
END IF
COLOR HiFG%,HiBG%
LOCATE MenuRow%,Colpos%,0
Position%(k%) = Colpos%
PRINT REMOVE$(Choices$(k%),"@");
IF LEN(Infoline$(k%)) > 0 THEN
IF SelectionMade% = 0 THEN
COLOR BarFG%,BarBG%
LOCATE MenuRow% + 1,1,0
PRINT SPACE$(80);
LOCATE MenuRow% + 1,Gap% + 1,0
PRINT Infoline$(k%);
InfoLinePrinted% = 1
END IF
END IF
ELSE
IF k% > 1 THEN 'this determines the column
Total% = 0 'position for printing the
FOR l% = 1 TO (k% - 1) 'rest of the menu
INCR Total%,(Gap%)
Fixedup$ = REMOVE$(Choices$(l%),"@")
Total% = Total% + LEN(Fixedup$)
NEXT l%
Colpos% = Total% + (Gap% + 1)
ELSE
Colpos% = Gap% + 1
END IF
LOCATE MenuRow%,Colpos%,0
Position%(k%) = Colpos%
IF INSTR(Choices$(k%),"@") > 0 THEN
HotKeyPos% = INSTR(Choices$(k%),"@")
Fixedup$ = REMOVE$(Choices$(k%),"@")
COLOR BarFG%,BarBG%
PRINT Fixedup$;
LOCATE MenuRow%,Colpos% + (HotKeyPos% - 1),0
COLOR OnOff%,BarBG%
HotKey$ = MID$(Choices$(k%),(HotKeyPos% + 1),1)
PRINT HotKey$;
ELSE
COLOR BarFG%,BarBG%
PRINT Choices$(k%);
END IF
END IF
NEXT k%
RETURN
'----------------------------------------------------------------------------
END SUB