Article View: comp.lang.modula2
Article #3486Help - Dedicating keys
From: Richard A Creed
Date: Tue, 16 Apr 1996 19:59
Date: Tue, 16 Apr 1996 19:59
62 lines
2141 bytes
2141 bytes
Any help most willingly received :
I'm using FST 3.5.
I would like to make one or more function keys availiable in a game
program I have written, sort of: F1 - Help (opens & a window)
F2 - Rules (opens a window)
F3 - Exit Programme
(and perhaps make the esc key availiable to close the windows).
I don't have any problem with the windows but I can't work out how
to dedicate a key so that it
a) Remains availiable throughout the program
b) Doesn't get muddled up with other keypresses.
i.e. is permanently availiable, and is independent of any other
keyboard activity (save perhaps the esc key).
I've experimented with KeyPressed() and come up with this test
module which will scroll 'blah' on the screen until I press F1:
MODULE TestKey2;
FROM InOut IMPORT WriteString;
FROM Keyboard IMPORT KeyPressed,GetFunKey,F1;
VAR
GotKey : CARDINAL;
PROCEDURE GetF1Key( VAR Key: CARDINAL );
BEGIN
IF KeyPressed() THEN
GetFunKey(Key);
ELSE
Key := 0; (*or any other value*)
END;
END GetNoWait;
BEGIN
GotKey := 0;
WHILE (GotKey <> 429) DO
GetF1Key(GotKey);
WriteString("blah ");
END;
END TestKey2.
but every way that I've tried to implement the principle in my real
program it seems to take the first keypress, then sit and wait for
F1, then never be seen again. I understand why it does this,
& I realise that I was barking up the wrong tree, but I could do
with directions to the right one.
Thanks, and with hope
Richard.
Richard Creed is at creed@bigsilver.win-uk.net
& once a week at cr589@gre.ac.uk
& always ? http://www.gre.ac.uk/~cr589/
Technical Details
Message-ID:
<273@bigsilver.win-uk.net>Path:
arc1-ca.pugleaf.net!laura.pcug.co.uk!bigsilver!creedShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!laura.pcug.co.uk!bigsilver!creed Newsgroups: comp.lang.modula2 Message-ID: <273@bigsilver.win-uk.net> Reply-To: creed@bigsilver.win-uk.net (Richard A Creed) From: creed@bigsilver.win-uk.net (Richard A Creed) Date: Tue, 16 Apr 1996 19:59:55 GMT Subject: Help - Dedicating keys