| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- IMPLEMENTATION MODULE Prompts;
- (*
- * ModBase
- * Release 3.0
- * (c) Copyright 1986 - 1991 PMI
- * P.O. Box 8402
- * Green Bay Wi 53308
- * All Rights Reserved
- * by Ed Ross
- *)
- FROM BigSets IMPORT AppendSet, InitSet;
- FROM KbdInput IMPORT AnyKeyNum, KeyHit, KeyNumSet, YorN;
- FROM M2Strings IMPORT Length;
- FROM MsgBox2 IMPORT MsgOkay, StrMsgBox;
- FROM ScrnTypes IMPORT DisplayFrame, InitDisplayFrame;
- FROM ScrnUtl2 IMPORT CloseDisplayFrame;
- FROM SmartScreen IMPORT ClearPart, SetCursorHeight, WriteAt;
- FROM StrConv IMPORT StrToCardinal,ReturnedCard,CardinalToStr;
- FROM StrEdit IMPORT AssignStr,CrunchBlanks;
- FROM StrInput IMPORT ReadWithEdits;
- FROM VWindows IMPORT Compass, CurrentWindow;
- FROM WindowPrims IMPORT DrawBox, GetCursorCoords, PopColors,
- PopCursorCoords, PopCursorHeight, PushColors, PushCursorCoords,
- PushCursorHeight, ScreenRestore, ScreenSave;
- IMPORT SYSTEM;
- VAR
- CH : CHAR;
- B : BOOLEAN;
- x2 : CARDINAL;
- PROCEDURE SetUp;
- BEGIN
- PushCursorHeight;
- PushCursorCoords;
- PushColors;
- ScreenSave(StatusScr,5,10,x2,15);
- ClearPart(5,10,x2,15);
- DrawBox(5,10,x2,15);
- END SetUp;
- PROCEDURE TakeDown;
- BEGIN
- PopCursorHeight;
- PopColors;
- ScreenRestore(StatusScr,5,10);
- PopCursorCoords;
- END TakeDown;
- PROCEDURE Prompt(S1: ARRAY OF CHAR);
- VAR Key : CARDINAL;
- DF : DisplayFrame;
- BEGIN
- InitDisplayFrame(DF,CurrentWindow);
- DF^.ClearAfter := TRUE;
- StrMsgBox(DF,NE,S1);
- CloseDisplayFrame(DF);
- END Prompt;
- PROCEDURE PromptStr(S1 : ARRAY OF CHAR; VAR S2 : ARRAY OF CHAR);
- VAR
- Insert : BOOLEAN;
- CurPos : CARDINAL;
- LastKey : CARDINAL;
- LegalKeys,
- ExitKeys : KeyNumSet;
- BEGIN
- x2 := HIGH(S1) + HIGH(S2)+12;
- SetUp;
- WriteAt(12,12,S1);
- CurPos := 0;
- Insert := TRUE;
- LegalKeys := AnyKeyNum;
- InitSet(LegalKeys);
- InitSet(ExitKeys);
- AppendSet(ExitKeys,"{8,9,271,13,27,328,336,329,337}");
- (* Means BackSpace, TAB, BackTab, CR, ESC, and the arrow
- keys let you out of a field. *)
- ReadWithEdits(CurrentWindow,S2,13+Length(S1),12,HIGH(S2),CurPos,
- Insert,FALSE,LastKey,
- AnyKeyNum,ExitKeys);
- TakeDown;
- END PromptStr;
- PROCEDURE PromptNum(S1 : ARRAY OF CHAR;DefaultNbr : CARDINAL): CARDINAL;
- VAR
- ExitKeys, NumKeys : KeyNumSet;
- TmpStr : ARRAY[1..5] OF CHAR;
- R,C : CARDINAL;
- Len : CARDINAL;
- Num : CARDINAL;
- Pos : CARDINAL;
- InsertMode : BOOLEAN;
- LastKey : CARDINAL;
- BEGIN
- x2 := HIGH(S1) + 5 + 12; (* 5 is for the digits *)
- SetUp;
- GetCursorCoords(C,R);
- InitSet(ExitKeys);
- AppendSet(ExitKeys,"{8,9,271,13,27,328,336,329,337}");
- (* Means BackSpace, TAB, BackTab, CR, ESC, and the arrow
- keys let you out of a field. *)
- WriteAt(12,12,S1);
- InitSet(NumKeys);
- AppendSet(NumKeys,'{"0".."9",8,9,271,13,27,328,336,329,337,331,333,339}');
- Len := 5;
- Pos := 0;
- CardinalToStr(DefaultNbr,5,TmpStr);
- CrunchBlanks(TmpStr);
- ReadWithEdits( CurrentWindow,TmpStr,13+Length(S1),12,Len,Pos,InsertMode,FALSE,
- LastKey, NumKeys, ExitKeys );
- TakeDown;
- RETURN ReturnedCard(TmpStr)
- END PromptNum;
- PROCEDURE PromptYN(S1 : ARRAY OF CHAR; DFrame : DisplayFrame) : BOOLEAN;
- (* Return true for yes ; false for no *)
- VAR
- DF : DisplayFrame;
- Key : CARDINAL;
- B : BOOLEAN;
- BEGIN
- InitDisplayFrame(DF,CurrentWindow);
- B := MsgOkay(DF,NW,S1);
- CloseDisplayFrame(DF);
- RETURN B;
- END PromptYN;
- PROCEDURE DisplayStatus(S1 : ARRAY OF CHAR);
- BEGIN
- END DisplayStatus;
- PROCEDURE RemoveDisplay();
- BEGIN
- END RemoveDisplay;
- BEGIN
- END Prompts.
|