Enable Caps Lock from SuperBASIC
Enable Caps Lock from SuperBASIC
Hi everyone,
Is it possible to enable Caps Lock from within SuperBASIC? I expected there to be a system variable I could poke to do this, though couldn't find anything obvious in the SuperBASIC manual.
Thanks in advance for any help,
George.
Is it possible to enable Caps Lock from within SuperBASIC? I expected there to be a system variable I could poke to do this, though couldn't find anything obvious in the SuperBASIC manual.
Thanks in advance for any help,
George.
-
- Aurora
- Posts: 970
- Joined: Tue Dec 17, 2013 1:17 pm
Re: Enable Caps Lock from SuperBASIC
You can on a Black Box QL with a POKE_W 163976,65280 to turn Caps Lock on, and POKE_W 163976,0 to turn it off.
However it does not work in QPC2. I'd also like to know a way of doing it in QPC2.
However it does not work in QPC2. I'd also like to know a way of doing it in QPC2.
Re: Enable Caps Lock from SuperBASIC
or POKE_W!! $88, -256/0 on SMSQ/E for caps lock on/off. As you say, it doesnt work on QPC2. This is because QPC2 cant change the Windoze caps lock status. No work-around, Im afraid. SMSQmulator cant do it either, but forgets to reset sys_caps accordingly..Martin_Head wrote:You can on a Black Box QL with a POKE_W 163976,65280 to turn Caps Lock on, and POKE_W 163976,0 to turn it off.
However it does not work in QPC2. I'd also like to know a way of doing it in QPC2.
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
- mk79
- QL Wafer Drive
- Posts: 1349
- Joined: Sun Feb 02, 2014 10:54 am
- Location: Esslingen/Germany
- Contact:
Re: Enable Caps Lock from SuperBASIC
QPC's priority is that the CapsLock state matches the CapsLock LED. The LED state cannot be controlled by applications, therefore I adopt the global state for the SMSQ/E state. It is possible to control the global CapsLock state by faking CapsLock presses, but that is quite some work for very little gain.Martin_Head wrote:However it does not work in QPC2. I'd also like to know a way of doing it in QPC2.
You can QPC_EXEC a tool that switches Windows CapsLock state if really necessary.
Re: Enable Caps Lock from SuperBASIC
That being said, depending on your program, you might be able to make a simple per-program workaroundpjw wrote:<> QPC2 cant change the Windoze caps lock status. No work-around, Im afraid.

Pressing the caps lock key is detectable with KEYROW, so you could maintain a local caps lock variable of
your own and convert keyboard input to uppercase depending on the status of that variable. However, the
degree of trickiness required depends on your program, the effect you require, and how important it is
to achieve it. "Theres is always a workaround" - he croaked..
Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Re: Enable Caps Lock from SuperBASIC
Well, the simplest case of workaround is simply uppercasing the input string and re-printing it. I think that is what you should do if you want upper-case input only.
On a multi-tasking machine that only has one caps lock state, I would actually consider it bad behavior of an application to hog the Caps Lock state - That is also why I don't really like your KEYROW approach, Per.
Changing to another app using <CTRL>-C and have Caps activated is really not expected behavior. I have a lot of upper-case/lower-case-different Hotkeys defined on my machine that would also be affected.
Tobias
On a multi-tasking machine that only has one caps lock state, I would actually consider it bad behavior of an application to hog the Caps Lock state - That is also why I don't really like your KEYROW approach, Per.
Changing to another app using <CTRL>-C and have Caps activated is really not expected behavior. I have a lot of upper-case/lower-case-different Hotkeys defined on my machine that would also be affected.
Tobias
ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Re: Enable Caps Lock from SuperBASIC
You are quite right, Tobias. There should be no need to set the universal caps lock status from software! I got my wires crossed there in more ways than onetofro wrote:Well, the simplest case of workaround is simply uppercasing the input string and re-printing it. I think that is what you should do if you want upper-case input only.
On a multi-tasking machine that only has one caps lock state, I would actually consider it bad behavior of an application to hog the Caps Lock state - That is also why I don't really like your KEYROW approach, Per.
Changing to another app using <CTRL>-C and have Caps activated is really not expected behavior. I have a lot of upper-case/lower-case-different Hotkeys defined on my machine that would also be affected.
Tobias

Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Re: Enable Caps Lock from SuperBASIC
Thanks for the various replies. My interest stems from porting Akalabeth to the BBQL. The original Akalabeth, on the Apple II, deals only with capitals, both for input and output. I'm trying to make the QL port as authentic as possible, but am conscious people may get confused if they play the game without Caps Lock.
Thinking about multiple application comment, I might relax the constraints to support lower case and upper case input.
Thanks again,
George.
Thinking about multiple application comment, I might relax the constraints to support lower case and upper case input.
Thanks again,
George.
- NormanDunbar
- Forum Moderator
- Posts: 2470
- Joined: Tue Dec 14, 2010 9:04 am
- Location: Buckie, Scotland
- Contact:
Re: Enable Caps Lock from SuperBASIC
You do know that in SuperBASIC that this works:
1000 a$ = 'Hello World'
...
2500 IF a$ == 'hello world' THEN
2510 ...
2520 END IF
In other words, use two equals signs and you get case ignored when comparing strings. There are details at http://superbasic-manual.readthedocs.io ... clean.html - scroll down to section A11.4 and refer to Note 2.
The INSTR command is also case insensitive.
HTH
Cheers,
Norm.
1000 a$ = 'Hello World'
...
2500 IF a$ == 'hello world' THEN
2510 ...
2520 END IF
In other words, use two equals signs and you get case ignored when comparing strings. There are details at http://superbasic-manual.readthedocs.io ... clean.html - scroll down to section A11.4 and refer to Note 2.
The INSTR command is also case insensitive.
HTH
Cheers,
Norm.
Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Author of Arduino Software Internals
Author of Arduino Interrupts
No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Re: Enable Caps Lock from SuperBASIC
I know it's not what we're used to but, ignoring for a moment the problems it would, no doubt, cause for the maintainers of "hosted" systems, wouldn't it be more logical for the CAPS state to be maintained on a per-job basis (or even a per-CON channel basis)?tofro wrote: On a multi-tasking machine that only has one caps lock state, I would actually consider it bad behavior of an application to hog the Caps Lock state
After all, why should I want/need the same CAPS state in, say, QTPI and Text87?
I have just tried this in QPC2 (using 'f' to PICK an existing QPAC2 Files job and 'F' to EXEC a new one) and it would appear that the HOTKEY system ignores the CAPS state, i.e. 'F' actually (and always) means SHIFT-F...tofro wrote: I have a lot of upper-case/lower-case-different Hotkeys defined on my machine that would also be affected.
John Hall