Redirect/reprogram a keypress?
Redirect/reprogram a keypress?
Here's the first of 2 questions tonight (sorry) - I suspect they will both be shot down instantly but if you don't ask, you never know...
My physical QL has a replacement keyboard membrane, but for one reason or another the operation of Ctrl+left cursor together is very hit and miss. You have to really hold Ctrl down for it to register. I could (and at some point, probably will) open it up and look to see if the membrane could be fractionally repositioned etc, but right now opening it up and messing with the membrane feels like asking for trouble...!
So deleting characters is a bit of a pain. Is it theoretically possible to install some kind of machine-code subroutine that would intercept when 'caps lock' was pressed and reinterpret that as pressing 'delete'? I was boggled when I first got a real QL a few weeks ago and realised it had no dedicated delete key, and I think it's kind of niggled me ever since. I think, even if I could get my Ctrl+left arrow combination working well, it would still be nice to run a patch that could remap a key to do 'delete' duty
Anyone ever tried anything like this - is it remotely a starter? I know nothing about the innards yet, although I've started accumulating documentation ready for a play....
My physical QL has a replacement keyboard membrane, but for one reason or another the operation of Ctrl+left cursor together is very hit and miss. You have to really hold Ctrl down for it to register. I could (and at some point, probably will) open it up and look to see if the membrane could be fractionally repositioned etc, but right now opening it up and messing with the membrane feels like asking for trouble...!
So deleting characters is a bit of a pain. Is it theoretically possible to install some kind of machine-code subroutine that would intercept when 'caps lock' was pressed and reinterpret that as pressing 'delete'? I was boggled when I first got a real QL a few weeks ago and realised it had no dedicated delete key, and I think it's kind of niggled me ever since. I think, even if I could get my Ctrl+left arrow combination working well, it would still be nice to run a patch that could remap a key to do 'delete' duty
Anyone ever tried anything like this - is it remotely a starter? I know nothing about the innards yet, although I've started accumulating documentation ready for a play....
-
- RWAP Master
- Posts: 2834
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: Redirect/reprogram a keypress?
It is probably a physical issue - most likely the screw on the backing plate nearest those keys is not tight enough (or you have managed to get a small kink in the keyboard membrane - ie not positioned it flat over the locating pegs).
It could also be the rubber bubble mat which sits under the keys which may have a hole or similar in the mat (I do have lots of these spare!)
The other option could even be something like crumbs under the keys!
You need to identify whether the keys work ok on their own (remember you could use the left cursor and then CTRL right to delete the character to the right). If they work on their own but not together, then I am stuck!
It could also be the rubber bubble mat which sits under the keys which may have a hole or similar in the mat (I do have lots of these spare!)
The other option could even be something like crumbs under the keys!
You need to identify whether the keys work ok on their own (remember you could use the left cursor and then CTRL right to delete the character to the right). If they work on their own but not together, then I am stuck!
Rich Mellor
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
Re: Redirect/reprogram a keypress?
We're not shooting anyone for asking a question (I'd rather think of tar and feathers )
What you want is partially possible, although not with the CAPS LOCK key - That key is like the other modifiers not generating a real key press, but is rather evaluated by the IPC and not sent to the QL.
With other keys that really generate a symbol, you could download or write a program that POKEs the symbol for DELETE into the keyboard buffer. Unfortunately, there's no other easy one to choose from, so I'd rather bite it and fix the key mechanically.
Tobias
What you want is partially possible, although not with the CAPS LOCK key - That key is like the other modifiers not generating a real key press, but is rather evaluated by the IPC and not sent to the QL.
With other keys that really generate a symbol, you could download or write a program that POKEs the symbol for DELETE into the keyboard buffer. Unfortunately, there's no other easy one to choose from, so I'd rather bite it and fix the key mechanically.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: Redirect/reprogram a keypress?
Yeah, you're probably both right. I just hate the thought of opening it up again!
Re: Redirect/reprogram a keypress?
First thing - isolate if it's the CTRL key or LEFT arrow key at fault, probably easiest way is to use a KEYROW loop to check for keypresses (KEYROW can detect CTRL, INKEY$ can't). I can't test this as I don't have a QL set up at th emoment and KEYROW on QPC2 doesn't detect CTRL (it does detect SHIFT and ALT)robsoft wrote: My physical QL has a replacement keyboard membrane, but for one reason or another the operation of Ctrl+left cursor together is very hit and miss. You have to really hold Ctrl down for it to register.
Code: Select all
100 REPeat loop
110 PRINT KEYROW(7)
120 END REPeat loop
Code: Select all
100 REPeat loop
110 PRINT KEYROW(1)
120 END REPeat loop
Now, as to reprogramming a key combination, use the ALTKEY command if you have Toolkit 2 active on your system. For example, if you find that the CTRL key is not working, you could reprogram some little used keys to become equivalent to CTLR LEFT, e.g. this will make ALT F5 behave like CTRL LEFT
ALTKEY CHR$(248),CHR$(194)
Not all keys (e.g. CAPS LOCK, TAB, Cursor arrow keys) can be reprogrammed like this, and of course ALT F5 is a lot less convenient than CTRL LEFT.
For single keypresses you could reprogram F1 to F5 but these are commonly used in programs like Quill.
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
Re: Redirect/reprogram a keypress?
Thanks Dilwyn, that's great, I appreciate your time keying all that in
As a matter of interest, how would I program a function key? I thought there might be an obvious SuperBASIC way of doing that, but either it's so obvious I'm over complicating it, or my Google skills have let me down today.dilwyn wrote: For single keypresses you could reprogram F1 to F5 but these are commonly used in programs like Quill.
Re: Redirect/reprogram a keypress?
Strictly speaking you don't (at least not in the same way as you would with a BBC micro, for example). You can use an ALTKEY definition to provide text which is replaced for the function key press, by using key codes 232,236, 240, 244, 248 for F1 to F5 respectively (add 2 to each code for SHIFT F1 etc to get up to 5 extra ones). For this to work, you press ALT F1 insteadof F1 (this is why I say they are not programmable as such).robsoft wrote:Thanks Dilwyn, that's great, I appreciate your time keying all that in
As a matter of interest, how would I program a function key? I thought there might be an obvious SuperBASIC way of doing that, but either it's so obvious I'm over complicating it, or my Google skills have let me down today.dilwyn wrote: For single keypresses you could reprogram F1 to F5 but these are commonly used in programs like Quill.
ALTKEY CHR$(232),"Hello"
That would just create text Hello when you press ALT F1. You can put in all sorts of keycodes too, for example a newline with CHR$(10):
ALTKEY CHR$(236),"Hello"&CHR$(10)&"There"
Alt-F1 now prints
Hello
There
You could generate your address for wordprocessing on ALT SHIFT F1 (SHIFT F1 is like F6 in a keyboard which has more than 5 function keys, as on a PC emulator) using something like this:
ALTKEY CHR$(234),"Robsoft"&CHR$(10)&"The Street"&CHR$(10)&"Anytown"
so that you could insert your address in a Quill document by just pressing ALT SHIFT F1.
I vaguely remember a machine code routine from Sinclair back in the very early days which I think allowed direct programming of function keys, I couldn't find it just then, but if I do I'll post it here for you later. The advantage of that is a that function keys become a single key press, the disadvantage being you lose the normal use of function keys (e.g. F1 for Help in Quill).
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
Re: Redirect/reprogram a keypress?
If this is Sinclair based (so a bit old), I think it would work like TK2 Altkey, say a polling task rather than a job. That would of course overwrite any job that polls the queue. I am sure it was written by TTdilwyn wrote:I vaguely remember a machine code routine from Sinclair back in the very early days which I think allowed direct programming of function keys, I couldn't find it just then, but if I do I'll post it here for you later. The advantage of that is a that function keys become a single key press, the disadvantage being you lose the normal use of function keys (e.g. F1 for Help in Quill).
Nevertheless, it would be interesting to see, as interesting as the SPK was .
Re: Redirect/reprogram a keypress?
My mistake,it was a Sinclair routine for user defined graphics (redefining fonts), not user defined keys - the routine is at http://www.dilwyn.me.uk/fonts/udg.zip.Ralf R. wrote:If this is Sinclair based (so a bit old), I think it would work like TK2 Altkey, say a polling task rather than a job. That would of course overwrite any job that polls the queue. I am sure it was written by TTdilwyn wrote:I vaguely remember a machine code routine from Sinclair back in the very early days which I think allowed direct programming of function keys, I couldn't find it just then, but if I do I'll post it here for you later. The advantage of that is a that function keys become a single key press, the disadvantage being you lose the normal use of function keys (e.g. F1 for Help in Quill).
Nevertheless, it would be interesting to see, as interesting as the SPK was .
--
All things QL - https://dilwyn.qlforum.co.uk/index.html
All things QL - https://dilwyn.qlforum.co.uk/index.html
- mk79
- QL Wafer Drive
- Posts: 1349
- Joined: Sun Feb 02, 2014 10:54 am
- Location: Esslingen/Germany
- Contact:
Re: Redirect/reprogram a keypress?
Actually that is probably not that difficult, at least for CapsLock. You can register a routine that is called on CapsLock by writing its address to sys_csub. The routine would have to post the delete character to the current keyboard queue and maybe reset the capslock status in case it's already toggled, I'm not sure.robsoft wrote:So deleting characters is a bit of a pain. Is it theoretically possible to install some kind of machine-code subroutine that would intercept when 'caps lock' was pressed and reinterpret that as pressing 'delete'?
Marcel