home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Monster Media 1994 #1
/
monster.zip
/
monster
/
PROG_BAS
/
DNALIB59.ZIP
/
DIALOG.BAS
< prev
next >
Wrap
BASIC Source File
|
1994-02-07
|
3KB
|
113 lines
DECLARE SUB PopWind(Title$,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Attr%,Shadow%,Border%)
DECLARE SUB SaveScreen(ScreenID$,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Shadow%)
DECLARE SUB RestoreScreen(ScreenID$,TopRow%,LeftColumn%)
DECLARE SUB CalcByte(Attr%,LowByte%,HiByte%)
DECLARE SUB Clicked(Rgt%,Lft%,Row%,Col%)
DECLARE SUB HideCursor()
DECLARE SUB ShowCursor()
DECLARE FUNCTION LeftButtonReleased%()
SUB Dialog(Choices$(),Title$,Mouse%,Cntr%,TopRow%,LeftColumn%,TxtColor%,Attr%,Shadow%,Border%) PUBLIC
CalcByte Attr%,FGround%,BGround%
IF Mouse% THEN HideCursor
i% = 0: j% = 0: Maxlength% = 0: AddedRow% = 0
DO
INCR i%
INCR j% 'first find out how many
'strings there are and the
IF LEN (Choices$(i%)) = 0 THEN 'length of the longest one
DECR i%
ELSEIF LEN (Choices$(i%)) > Maxlength% THEN
Maxlength% = LEN (Choices$(i%))
END IF
LOOP WHILE i% = j%
Count% = i%
INCR Maxlength% 'add a space
SELECT CASE Cntr%
CASE 1 'centre the window
Centre% = 1
CASE 2 'centre the text
CentreText% = 1
CASE 3 'centre both text and window
Centre% = 1
CentreText% = 1
END SELECT
IF Centre% = 1 THEN 'do they want it centred
LeftColumn% = 40 - ((Maxlength% + 2) / 2)
RightColumn% = LeftColumn% + (Maxlength% + 2)
TopRow% = (25 - Count%) \ 2
BottomRow% = TopRow% + (Count% + 1)
ELSE
RightColumn% = LeftColumn% + (Maxlength% + 2)
BottomRow% = TopRow% + (Count% + 1)
END IF
SaveScreen DLog$,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Shadow%
PopWind Title$,TopRow%,LeftColumn%,BottomRow%,RightColumn%,Attr%,Shadow%,Border%
IF Mouse% THEN
Test% = LEN(Title$)
COLOR FGround%,BGround%
IF Test% THEN
IF Test% + 16 <= RightColumn% - LeftColumn% THEN
LOCATE TopRow%,LeftColumn% + 2,0
PRINT CHR$(91,254,93);
ELSE
LOCATE BottomRow%,LeftColumn% + 2,0
PRINT CHR$(91,254,93);
END IF
ELSE
LOCATE TopRow%,LeftColumn% + 2,0
PRINT CHR$(91,254,93);
END IF
END IF
Row% = TopRow% + 1
Col% = LeftColumn% + 1
FOR a% = 1 TO Count%
COLOR TxtColor%,BGround%
LOCATE Row%,Col%,0
IF CentreText% = 1 THEN
b% = (Maxlength% + 1) - LEN(Choices$(a%))
c% = b% \ 2
d% = b% - c%
PRINT SPACE$(c%) + Choices$(a%) + SPACE$(d%)
ELSE
PRINT SPACE$(1) + Choices$(a%) + SPACE$(Maxlength% - LEN(Choices$(a%)))
END IF
INCR Row%
NEXT a%
WHILE NOT INSTAT
IF Mouse% THEN
ShowCursor
Clicked Rgt%,Lft%,MRow%,MCol%
IF LeftButtonReleased% THEN
IF MCol% = LeftColumn% + 3 THEN
IF MRow% = TopRow% OR MRow% = BottomRow% THEN
HideCursor
EXIT LOOP
END IF
ELSEIF MRow% < TopRow% OR MRow% > BottomRow% OR_
MCol% < LeftColumn% OR MCol% > RightColumn% THEN
HideCursor
EXIT LOOP
END IF
END IF
END IF
WEND
Ky$ = INKEY$
RestoreScreen Dlog$,TopRow%,LeftColumn%
END SUB