Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -1,95 +1,91 @@
|
|||
\12345678901234567890123456789012345
|
||||
\User input/Graphical.......... X .
|
||||
\ Please enter a string and 75000: .
|
||||
\ String: Hello, World!___ .
|
||||
\ Number: 75000___________ .
|
||||
\012345678901234567890123456789012345
|
||||
\ User input/Graphical.......... X .
|
||||
\ Please enter a string and 75000: .
|
||||
\ String: Hello, World!___. .
|
||||
\ Number: 75000___________. .
|
||||
|
||||
def X0=20, Y0=10; \upper-left corner of window's position (chars)
|
||||
def X0=20, Y0=10; \position of upper-left corner of window (chars)
|
||||
int Mouse, Button, X, Y, Ch, I, SN; \SN = string number = 0 or 1
|
||||
def StrMax = 16; \maximum number of characters in strings
|
||||
char String(2, StrMax); \string arrays (includes Number string)
|
||||
char String(2, StrMax); \2 string arrays (including Number string)
|
||||
int StrInx(2); \index to character to be added to String
|
||||
int Mouse, Button, C, I, SN;
|
||||
|
||||
func GetButton; \Return soft button number at mouse pointer
|
||||
int X, Y;
|
||||
[Mouse:= GetMouse;
|
||||
X:= Mouse(0)/8 - X0; \convert pixels to char cells
|
||||
X:= Mouse(0)/8 - X0; \convert pixels to 8x16-pixel character cells
|
||||
Y:= Mouse(1)/16 - Y0;
|
||||
if X>=32 & X<=34 & Y=0 then return 0; \exit [X]
|
||||
if X>=32 & X<=34 & Y=0 then return 0; \exit [X]
|
||||
if X>=10 & X<=10+StrMax & Y=4 then return 1; \line 1
|
||||
if X>=10 & X<=10+StrMax & Y=6 then return 2; \line 2
|
||||
return -1; \mouse not on any soft button
|
||||
];
|
||||
|
||||
proc ShowCursor(Flag); \Turn cursor at insertion point on or off
|
||||
proc ShowCursor(Flag); \Turn cursor at end of active String on or off
|
||||
int Flag;
|
||||
[Cursor(10+StrInx(SN)+X0, 4+SN*2+Y0);
|
||||
ChOut(6, if Flag then ^_ else ^ );
|
||||
];
|
||||
|
||||
[SetVid($12); \640x480 graphics
|
||||
TrapC(true); \disable Ctrl+C
|
||||
Attrib($70); \black on gray
|
||||
SetWind(0+X0, 0+Y0, 35+X0, 8+Y0, 0, \fill\true);
|
||||
Cursor(33+X0, 0+Y0); Text(6, "X");
|
||||
[SetVid($12); \set 640x480 graphics
|
||||
TrapC(true); \prevent Ctrl+C from aborting the program
|
||||
Attrib($70); \set black-on-gray color attribute
|
||||
SetWind(0+X0, 0+Y0, 35+X0, 8+Y0, 0, \fill\true); \draw gray rectangle
|
||||
Cursor(33+X0, 0+Y0); Text(6, "X"); \draw exit button
|
||||
Cursor(2+X0, 2+Y0); Text(6, "Please enter a string and 75000:");
|
||||
Cursor(2+X0, 4+Y0); Text(6, "String:");
|
||||
Cursor(2+X0, 6+Y0); Text(6, "Number:");
|
||||
|
||||
Attrib($1F); \bright white on blue, for title
|
||||
Attrib($9F); \set bright white on light blue, for title bar
|
||||
Cursor(0+X0, 0+Y0); Text(6, " User input/Graphical ");
|
||||
|
||||
Attrib($F0); \black on bright white
|
||||
Attrib($F0); \set black on bright white
|
||||
for SN:= 0 to 1 do \initialize Strings
|
||||
[StrInx(SN):= 0;
|
||||
Cursor(10+X0, 4+SN*2+Y0);
|
||||
[Cursor(10+X0, 4+SN*2+Y0);
|
||||
for I:= 0 to StrMax-1 do
|
||||
[String(SN, I):= $20; ChOut(6, ^ )];
|
||||
[String(SN, I):= ^ ; ChOut(6, ^ )];
|
||||
ChOut(6, ^ ); \add one more for cursor underline at StrMax
|
||||
StrInx(SN):= 0;
|
||||
];
|
||||
SN:= 0; \select first, topmost String
|
||||
SN:= 0; \select first (topmost) String
|
||||
ShowCursor(true);
|
||||
|
||||
ShowMouse(true);
|
||||
ShowMouse(true); \turn on mouse pointer
|
||||
loop [MoveMouse; \make pointer track mouse movements
|
||||
Mouse:= GetMouse;
|
||||
Mouse:= GetMouse; \get pointer to mouse array information
|
||||
if Mouse(2) then \a left or right mouse button is down
|
||||
[Button:= GetButton; \get soft button at mouse pointer
|
||||
while Mouse(2) do \wait for mouse button's release
|
||||
while Mouse(2) do \wait for mouse button(s) to be released
|
||||
[MoveMouse;
|
||||
Mouse:= GetMouse;
|
||||
];
|
||||
if Button = GetButton then \if down Button = release button
|
||||
[if Button = 0 then quit;
|
||||
if Button # -1 then \move cursor to active String
|
||||
[ShowCursor(false);
|
||||
if Button = GetButton then \if down Button = release button and it
|
||||
[if Button = 0 then quit; \is the exit [X] button then quit loop
|
||||
if Button # -1 then \move cursor underline to active String
|
||||
[ShowMouse(false); \don't overwrite mouse pointer
|
||||
ShowCursor(false); \turn off cursor at old String position
|
||||
SN:= Button-1;
|
||||
ShowCursor(true);
|
||||
ShowCursor(true); \turn on cursor for selected String
|
||||
ShowMouse(true); \mouse pointer is normally displayed
|
||||
];
|
||||
];
|
||||
];
|
||||
if KeyHit then
|
||||
[ShowMouse(false); \don't overwrite mouse pointer
|
||||
C:= ChIn(1); \get character from non-echoed keyboard
|
||||
if SN = 0 and C >= $20 and C <= $7E or \all printable ASCIIs
|
||||
SN = 1 and C >= $30 and C <= $39 then \only numeric digits
|
||||
[String(SN, StrInx(SN)):= C;
|
||||
if StrInx(SN) < StrMax-1 then StrInx(SN):= StrInx(SN)+1;
|
||||
ShowCursor(false); \remove cursor underline cuz it moves
|
||||
Ch:= ChIn(1); \get character from non-echoed keyboard
|
||||
if SN=0 & Ch>=$20 & Ch<=$7E or \allow all printable chars
|
||||
SN=1 & Ch>=$30 & Ch<=$39 then \allow only numeric digits
|
||||
[if StrInx(SN) < StrMax then
|
||||
[String(SN, StrInx(SN)):= Ch; StrInx(SN):= StrInx(SN)+1];
|
||||
]
|
||||
else if C = \BS\$08 then \delete back a character
|
||||
[ShowCursor(false);
|
||||
if StrInx(SN) > 0 then StrInx(SN):= StrInx(SN)-1;
|
||||
]
|
||||
else if C = \tab\$09 then \select next string
|
||||
[ShowCursor(false);
|
||||
SN:= rem((SN+1)/2);
|
||||
]
|
||||
else if C = \Esc\$1B then quit;
|
||||
else if Ch = \BS\$08 then \delete back a character
|
||||
[if StrInx(SN) > 0 then StrInx(SN):= StrInx(SN)-1]
|
||||
else if Ch = \tab\$09 then \select next string
|
||||
SN:= rem((SN+1)/2)
|
||||
else if Ch = \Esc\$1B then quit;
|
||||
|
||||
Cursor(10+X0, 4+SN*2+Y0); \show active String
|
||||
for I:= 0 to StrInx(SN)-1 do ChOut(6, String(SN, I));
|
||||
ChOut(6, ^_);
|
||||
ChOut(6, ^_); \show cursor underline at end of String
|
||||
ShowMouse(true);
|
||||
];
|
||||
];
|
||||
]; \loop
|
||||
SetVid(3); \restore normal text mode immediately
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue