From: Ross_Boyd@tnt.com.au
Hi,
This is weird. Now I'm answering my own Email :)
I found a way of doing this. The solution might be instructive for some.
The trick is to Hook() into the _AFTER_GETKEY_ event and update the key
using Set(key,whatever).
Here's an example of forcing capitals and disallowing numerics:
// Hooked to _AFTER_GETKEY_ event
proc UpperCaseFilteredRead()
integer ikey = Query(key)
if ikey in ..
// Uppercase the key
Set(key, ikey^32)
elseif ikey in ..
// I want to ignore the above numeric keys
// This forces the key to a non-typeable key
Set(key, )
endif
end
proc Main()
string inputstr[20] = ""
Hook(_AFTER_GETKEY_,UpperCaseFilteredRead)
if Read(inputstr)
Message("You typed:",inputstr)
endif
Unhook(UpperCaseFilteredRead)
end
Question: Is there a better way than forcing invalid keys to ??
Any feedback appreciated,
Ross Boyd
----------------------------
From: Ross.Boyd
To: tsepro
Subject: Question: Limiting keys in a Read()
Date: Thursday, 8 January 1998 14:12
Hi all,
Can someone point me towards a way to limit the available keys in a Read()?
I want to force input to UpperCase - _as_ it is _typed_.
Also, a way to limit the user to just a set of characters would be helpful.
Thanks in advance,
Ross
---
---------------
* Origin: apana>>>>>fidonet [sawasdi.apana.org.au] (3:800/846.13)
|