Re: [BLACKBOX] Program freezes when window loses focus

From: [at]} <Rex>
Date: Tue, 29 Mar 2011 15:26:21 -0500

----boundary-LibPST-iamunique-293093510_-_-
Content-type: text/plain

At 06:42 PM 3/28/2011, Stephen Troy wrote:
>Thanks, Rex, but it seems as though the application is really, really freezing, and it doesn't seem to respond to anything, up to and including a sledgehammer.


        Yes, I know. At this point I'm trying to understand it myself. This shows my profound ignorance of Windows programming, but beyond that, I'm trying to find a ReadKey method that works. With just the line

REPEAT UNTIL ORD(XYplane.ReadKey()) #0

the display freezes solid if you change focus with the mouse, but it still reponds to the keystroke if you <Alt><Tab> through windows.

With

REPEAT
        ProcessMessages
UNTIL ORD(k.ReadKey()) # 0;

ReadKey is unresponsive, and there are bizarre, unpredictable effects on the BB GUI. (Complete program below)

        Does BB have any simple, unfailing procedure to read input directly from the keyboard? Evidently XYplane.ReadKey doesn't work. There has to be something.

Rex Couture


MODULE TestReadKey; (* Not working *)
IMPORT k:=XYplane,StdLog, Win:= WinApi;

PROCEDURE ProcessMessages;
  VAR msg: Win.MSG; res: INTEGER;
BEGIN
  WHILE Win.PeekMessage(msg, 0, 0, 0, Win.PM_REMOVE) # 0 DO
    res := Win.TranslateMessage(msg);
    res := Win.DispatchMessageA(msg)
  END
END ProcessMessages;

PROCEDURE P*;
        VAR c: CHAR;
        BEGIN
        REPEAT
                ProcessMessages
        UNTIL ORD(k.ReadKey()) # 0;
        StdLog.Ln;
        StdLog.String( 'If you see this, it works');
        END P;
END TestReadKey.


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-293093510_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1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9jZXNzTWVz
c2FnZXM7XHBhcg0KXHBhcg0KUFJPQ0VEVVJFIFAqO1xwYXINCiAgICAgICAgVkFSIGM6IENIQVI7
XHBhcg0KICAgICAgICBCRUdJTlxwYXINCiAgICAgICAgUkVQRUFUXHBhcg0KICAgICAgICAgICAg
ICAgIFByb2Nlc3NNZXNzYWdlc1xwYXINCiAgICAgICAgVU5USUwgT1JEKGsuUmVhZEtleSgpKSAj
IDA7XHBhcg0KICAgICAgICBTdGRMb2cuTG47XHBhcg0KICAgICAgICBTdGRMb2cuU3RyaW5nKCAn
SWYgeW91IHNlZSB0aGlzLCBpdCB3b3JrcycpO1xwYXINCiAgICAgICAgRU5EIFA7XHBhcg0KRU5E
IFRlc3RSZWFkS2V5LiBccGFyDQpccGFyDQpccGFyDQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUs
IHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lHTk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZA
TElTVFMuT0JFUk9OLkNIfX0AQkxBQw==
----boundary-LibPST-iamunique-293093510_-_---
Received on Tue Mar 29 2011 - 22:26:21 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:16 UTC