Initial import
This commit is contained in:
parent
85c0ec5572
commit
217dc31fa3
|
@ -0,0 +1,92 @@
|
|||
// =========================================================================
|
||||
// TESTBOX.MPS : MPL example of using the ANSI box class functions
|
||||
// =========================================================================
|
||||
|
||||
Procedure SetBoxDefaults (Handle: LongInt; Header: String);
|
||||
Begin
|
||||
// Mystic boxes default to the grey 3D style boxes used in the
|
||||
// configuration, but you can change all aspects of them if you want
|
||||
// to using the functions below.
|
||||
|
||||
If Header <> '' Then
|
||||
BoxHeader (Handle, // Box class handle
|
||||
0, // Header justify (0=center, 1=left, 2=right)
|
||||
31, // Header attribute
|
||||
Header); // Header text
|
||||
|
||||
// Available Box Frame types:
|
||||
//
|
||||
// 1 = ÚÄ¿³³ÀÄÙ
|
||||
// 2 = ÉÍ»ººÈͼ
|
||||
// 3 = ÖÄ·ººÓĽ
|
||||
// 4 = Õ͸³³Ô;
|
||||
// 5 = ÛßÛÛÛÛÜÛ
|
||||
// 6 = ÛßÜÛÛßÜÛ
|
||||
// 7 =
|
||||
// 8 = .-.||`-'
|
||||
|
||||
// Box shadows (if enabled) will actually read the characters under them
|
||||
// and shade them using the shadow attribute.
|
||||
|
||||
BoxOptions (Handle, // Box class handle
|
||||
2, // Box frame type (1-8)
|
||||
False, // Use "3D" box shading effect
|
||||
8, // Box attribute
|
||||
8, // Box 3D effect attr1 (if on)
|
||||
8, // Box 3D effect attr2 (if on)
|
||||
8, // Box 3D effect attr3 (if on)
|
||||
True, // Use box shadowing
|
||||
112); // Box shadow attribute
|
||||
End;
|
||||
|
||||
Var
|
||||
BoxHandle : LongInt;
|
||||
Begin
|
||||
PurgeInput;
|
||||
|
||||
ClrScr;
|
||||
|
||||
WriteXY (20, 5, 12, 'This is a line of text that will have a window');
|
||||
WriteXY (20, 6, 12, 'drawn over top of it. Press a key to draw a box');
|
||||
|
||||
ReadKey;
|
||||
|
||||
ClassCreate (BoxHandle, 'box');
|
||||
|
||||
BoxOpen (BoxHandle, // Box class handle
|
||||
20, // top X corner of box
|
||||
5, // top Y corner of box
|
||||
60, // bottom X corner of box
|
||||
10); // bottom Y corner of box
|
||||
|
||||
WriteXY (1, 1, 15, 'Press any key to close the box');
|
||||
WriteXY (1, 2, 15, 'The screen contents under the box will be restored!');
|
||||
|
||||
ReadKey;
|
||||
|
||||
// Closing a box will restore what was "under" it on the screen before the
|
||||
// box was created. You do not HAVE to close boxes if you dont want to.
|
||||
|
||||
BoxClose (BoxHandle);
|
||||
|
||||
WriteXY (1, 11, 11, 'Now lets change the box values. Press a key');
|
||||
|
||||
ReadKey;
|
||||
|
||||
// Now lets change the defaults to the box and open another one
|
||||
|
||||
SetBoxDefaults (BoxHandle, ' My Window Header ');
|
||||
|
||||
// We are done with the box class, so free it from MPL class stack.
|
||||
|
||||
BoxOpen (BoxHandle, 20, 5, 60, 10);
|
||||
|
||||
ReadKey;
|
||||
|
||||
BoxClose (BoxHandle);
|
||||
ClassFree (BoxHandle);
|
||||
|
||||
WriteXY (1, 14, 10, 'Pretty cool huh? Press a key to exit.');
|
||||
|
||||
ReadKey;
|
||||
End.
|
|
@ -0,0 +1,51 @@
|
|||
// =========================================================================
|
||||
// TESTINPUT : MPL example of using the ANSI input and box classes
|
||||
// =========================================================================
|
||||
|
||||
Var
|
||||
Box : LongInt;
|
||||
In : LongInt;
|
||||
InPos : Byte = 1;
|
||||
Str : String = 'Input default';
|
||||
Num : LongInt = 1;
|
||||
Begin
|
||||
PurgeInput;
|
||||
|
||||
ClassCreate (Box, 'box');
|
||||
ClassCreate (In, 'input');
|
||||
|
||||
BoxHeader (Box, 0, 31, ' Input Demo ');
|
||||
|
||||
InputOptions (In, // Input class handle
|
||||
31, // Attribute of inputted text
|
||||
25, // Attribute to use for field input filler
|
||||
#176, // Character to use for field input filler
|
||||
#9, // Input will exit on these "low" ascii characters
|
||||
// TAB
|
||||
#72 + #80); // Input will exit on these "extended" characters
|
||||
// UP and DOWN arrows
|
||||
|
||||
BoxOpen (Box, 20, 5, 60, 12);
|
||||
|
||||
Repeat
|
||||
WriteXY (22, 7, 112, 'String Input > ' + PadRT(Str, 22, ' '));
|
||||
WriteXY (22, 8, 112, 'Number Input > ' + PadRT(Int2Str(Num), 5, ' '));
|
||||
WriteXY (38, 10, 112, ' DONE ');
|
||||
|
||||
Case InPos of
|
||||
1 : Str := InputString (In, 37, 7, 22, 22, 1, Str);
|
||||
2 : Num := InputNumber (In, 37, 8, 5, 5, 1, 65000, Num);
|
||||
3 : If InputEnter (In, 38, 10, 6, ' DONE ') Then Break;
|
||||
End;
|
||||
|
||||
Case InputExit(In) of
|
||||
#09,
|
||||
#80 : If InPos < 3 Then InPos := InPos + 1 Else InPos := 1;
|
||||
#72 : If InPos > 1 Then InPos := InPos - 1 Else InPos := 3;
|
||||
End;
|
||||
Until False;
|
||||
|
||||
BoxClose (Box);
|
||||
ClassFree (Box);
|
||||
ClassFree (In);
|
||||
End.
|
Loading…
Reference in New Issue