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$,Seconds%,Mouse%,Cntr%,TopRow%,LeftColumn%,TxtColor%,Attr%,Shadow%,Border%) PUBLIC $CODE SEG "DNASEG1" 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% AND ISFALSE Seconds% THEN Test% = LEN(Title$) COLOR FGround%,BGround% IF Test% THEN IF Test% + 16 <= RightColumn% - LeftColumn% THEN LOCATE TopRow%,LeftColumn% + 1,0 PRINT CHR$(91,254,93); ELSE LOCATE BottomRow%,LeftColumn% + 1,0 PRINT CHR$(91,254,93); END IF ELSE LOCATE TopRow%,LeftColumn% + 1,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% IF Seconds% THEN DELAY Seconds%: GOTO Wayout WHILE NOT INSTAT IF Mouse% THEN ShowCursor Clicked Rgt%,Lft%,MRow%,MCol% IF LeftButtonReleased% THEN IF MCol% = LeftColumn% + 2 THEN IF MRow% = TopRow% OR MRow% = BottomRow% THEN EXIT LOOP END IF ELSEIF MRow% < TopRow% OR MRow% > BottomRow% OR_ MCol% < LeftColumn% OR MCol% > RightColumn% THEN EXIT LOOP END IF END IF END IF WEND Ky$ = INKEY$ Wayout: IF Mouse% THEN HideCursor RestoreScreen Dlog$,TopRow%,LeftColumn% END SUB