Enable Caps Lock from SuperBASIC

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

Enable Caps Lock from SuperBASIC

Postby georgeo » Sat Jan 20, 2018 10:20 am

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
Gold Card
Posts: 291
Joined: Tue Dec 17, 2013 1:17 pm

Re: Enable Caps Lock from SuperBASIC

Postby Martin_Head » Sat Jan 20, 2018 11:01 am

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
Gold Card
Posts: 375
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: Enable Caps Lock from SuperBASIC

Postby pjw » Sat Jan 20, 2018 12:12 pm

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
For every complex problem there is an answer that is clear, simple, and wrong.
- H. L. Mencken
User avatar
mk79
Over Heated PSU
Posts: 137
Joined: Sun Feb 02, 2014 10:54 am

Re: Enable Caps Lock from SuperBASIC

Postby mk79 » Sat Jan 20, 2018 12:31 pm

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
Gold Card
Posts: 375
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: Enable Caps Lock from SuperBASIC

Postby pjw » Sat Jan 20, 2018 12:38 pm

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
For every complex problem there is an answer that is clear, simple, and wrong.
- H. L. Mencken
User avatar
tofro
QL Wafer Drive
Posts: 1368
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Enable Caps Lock from SuperBASIC

Postby tofro » Sat Jan 20, 2018 12:55 pm

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


User avatar
pjw
Gold Card
Posts: 375
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway

Re: Enable Caps Lock from SuperBASIC

Postby pjw » Sat Jan 20, 2018 3:00 pm

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
For every complex problem there is an answer that is clear, simple, and wrong.
- H. L. Mencken
georgeo
Bent Pin Expansion Port
Posts: 92
Joined: Wed Aug 03, 2016 8:49 am

Re: Enable Caps Lock from SuperBASIC

Postby georgeo » Sun Jan 21, 2018 9:44 pm

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
Gold Card
Posts: 451
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Enable Caps Lock from SuperBASIC

Postby NormanDunbar » Sun Jan 21, 2018 10:26 pm

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?
How come Tarzan never grew a beard?
If at first you don't succeed, don't take up skydiving!
johnh
ROM Dongle
Posts: 15
Joined: Mon Mar 28, 2011 10:12 pm
Location: South Wales

Re: Enable Caps Lock from SuperBASIC

Postby johnh » Mon Jan 22, 2018 11:59 am

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



Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 1 guest