----boundary-LibPST-iamunique-781994473_-_-
Content-type: text/plain
>In fact I'd like to know how to handle keyboard events generally,
>e.g. a key press for suspending the execution of a program,
>followed by another key press to re-activate the program. Can
>anyone provide a simple example?
Here's an edited example from one of my programs:
-----
PROCEDURE HandleKey( v: View; key: CHAR );
CONST
arrowLeft = 1CX;
arrowRight = 1DX;
arrowUp = 1EX;
arrowDown = 1FX;
esc = 1BX;
BEGIN
CASE key OF
| arrowRight:
settings.horizontal := settings.horizontal - 0.1;
Views.Update(v, Views.keepFrames)
| arrowLeft:
settings.horizontal := settings.horizontal + 0.1;
Views.Update(v, Views.keepFrames)
| arrowDown:
settings.vertical := settings.vertical + 0.1;
Views.Update(v, Views.keepFrames)
| arrowUp:
settings.vertical := settings.vertical - 0.1;
Views.Update(v, Views.keepFrames)
| esc:
settings.horizontal := 0;
settings.vertical := 0;
Views.Update(v, Views.keepFrames)
| "p", "P":
pause := ~pause;
Views.Update(v, Views.keepFrames)
ELSE
END
END HandleKey;
PROCEDURE ( v: View ) HandleCtrlMsg
( f: Views.Frame; VAR msg: Controllers.Message; VAR focus: Views.View );
BEGIN
WITH msg: Controllers.EditMsg DO
IF msg.op = Controllers.pasteChar THEN
HandleKey( v, msg.char )
END
| msg: Controllers.TrackMsg DO
HandleMouse( v, f, msg )
ELSE
END
END HandleCtrlMsg;
-----
--------------------------------------------
To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
blackbox-request{([at]})nowhere.xy
To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.
Send any problem reports or questions related to this email list to the list owner at
owner-blackbox{([at]})nowhere.xy
Current posting policy:
a) To post you should use the same address by which you are subscribed to the mailing list. That way, the list server will recognize you as subscriber and forward your posting immediately, without creating any overhead.
b) If, for some reason, you cannot post from the address, by which you are subscribed, your message will be moderated to avoid spam. Please understand that moderation will often cause some delay, in particular over weekends or holydays.
----boundary-LibPST-iamunique-781994473_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attach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8gdGhpcyBl
bWFpbCBsaXN0IHRvIHRoZSBsaXN0IG93bmVyIGF0XHBhcg0KICAgb3duZXItYmxhY2tib3hAb2Jl
cm9uLmNoXHBhcg0KXHBhcg0KQ3VycmVudCBwb3N0aW5nIHBvbGljeTpccGFyDQpccGFyDQphKSBU
byBwb3N0IHlvdSBzaG91bGQgdXNlIHRoZSBzYW1lIGFkZHJlc3MgYnkgd2hpY2ggeW91IGFyZSBz
dWJzY3JpYmVkIHRvIHRoZSBtYWlsaW5nIGxpc3QuIFRoYXQgd2F5LCB0aGUgbGlzdCBzZXJ2ZXIg
d2lsbCByZWNvZ25pemUgeW91IGFzIHN1YnNjcmliZXIgYW5kIGZvcndhcmQgeW91ciBwb3N0aW5n
IGltbWVkaWF0ZWx5LCB3aXRob3V0IGNyZWF0aW5nIGFueSBvdmVyaGVhZC5ccGFyDQpccGFyDQpi
KSBJZiwgZm9yIHNvbWUgcmVhc29uLCB5b3UgY2Fubm90IHBvc3QgZnJvbSB0aGUgYWRkcmVzcywg
Ynkgd2hpY2ggeW91IGFyZSBzdWJzY3JpYmVkLCB5b3VyIG1lc3NhZ2Ugd2lsbCBiZSBtb2RlcmF0
ZWQgdG8gYXZvaWQgc3BhbS4gUGxlYXNlIHVuZGVyc3RhbmQgdGhhdCBtb2RlcmF0aW9uIHdpbGwg
b2Z0ZW4gY2F1c2Ugc29tZSBkZWxheSwgaW4gcGFydGljdWxhciBvdmVyIHdlZWtlbmRzIG9yIGhv
bHlkYXl9fQBuZy5jb20gKFsxOTI
----boundary-LibPST-iamunique-781994473_-_---
Received on Tue Jan 06 2004 - 00:40:39 UTC
This archive was generated by hypermail 2.3.0
: Thu Sep 26 2013 - 06:28:59 UTC