Enable Caps Lock from SuperBASIC

Anything QL Software or Programming Related.
georgeo
Bent Pin Expansion Port
Posts: 95
Joined: Wed Aug 03, 2016 8:49 am

Enable Caps Lock from SuperBASIC

Post by georgeo »

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.


Martin_Head
Aurora
Posts: 847
Joined: Tue Dec 17, 2013 1:17 pm

Re: Enable Caps Lock from SuperBASIC

Post by Martin_Head »

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.


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Enable Caps Lock from SuperBASIC

Post by pjw »

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.
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..


Per
dont be happy. worry
- ?
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Enable Caps Lock from SuperBASIC

Post by mk79 »

Martin_Head wrote:However it does not work in QPC2. I'd also like to know a way of doing it in QPC2.
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.
You can QPC_EXEC a tool that switches Windows CapsLock state if really necessary.


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Enable Caps Lock from SuperBASIC

Post by pjw »

pjw wrote:<> QPC2 cant change the Windoze caps lock status. No work-around, Im afraid.
That being said, depending on your program, you might be able to make a simple per-program workaround ;)
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
dont be happy. worry
- ?
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Enable Caps Lock from SuperBASIC

Post by tofro »

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


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Enable Caps Lock from SuperBASIC

Post by pjw »

tofro 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
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 one ;)


Per
dont be happy. worry
- ?
georgeo
Bent Pin Expansion Port
Posts: 95
Joined: Wed Aug 03, 2016 8:49 am

Re: Enable Caps Lock from SuperBASIC

Post by georgeo »

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.


User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Enable Caps Lock from SuperBASIC

Post by NormanDunbar »

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.


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.
johnh
ROM Dongle
Posts: 19
Joined: Mon Mar 28, 2011 10:12 pm
Location: South Wales

Re: Enable Caps Lock from SuperBASIC

Post by johnh »

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
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)?

After all, why should I want/need the same CAPS state in, say, QTPI and Text87?
tofro wrote: I have a lot of upper-case/lower-case-different Hotkeys defined on my machine that would also be affected.
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...

John Hall


Post Reply