= character not mapped?

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10075
Joined: Fri Feb 19, 2010 10:17 am

Re: = character not mapped?

Post by richmond62 » Wed Mar 27, 2024 3:12 pm

This sort of 'magic' goes on if one plays around with a Korean keyboard layout:
-
Screenshot 2024-03-27 at 16.10.45.png
Screenshot 2024-03-27 at 16.10.45.png (71.18 KiB) Viewed 1925 times
-
The 3rd field is the numToCodePoint of the top field.

PaulDaMacMan
Posts: 683
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: = character not mapped?

Post by PaulDaMacMan » Fri Mar 29, 2024 1:22 am

I'm still not sure what these rawKey numbers are actually based on? I mean these larger numbers that get returned, beyond the base ASCII set of characters. Are they standards keyboard 'scan codes' based? Or 'virtual key codes'''? Based on some extended character encoding number set such as classic Mac Roman? When I check these numbers against various lists, I can't make these numbers in the 6500s (multi-byte) range match any of the numberings I've found in various lists of keyboard scan codes and the like.

Here's a PDF of a list of these numbers returned from rawKeyDown . that I had collected at one point, produced by a newer Aluminum Apple US Keyboard :
https://github.com/PaulMcClernan/LiveCo ... 0CODES.pdf

I image this issue with international keyboards not placing the '=' character could be easy to work-around by adding to main stack script a rawKeyDown script which translates / forwards it as the desired character like so:

Code: Select all

on rawKeyDown pKey
  if pKey is 65469 then
     send "keyDown =" to the focusedControl
  else 
     pass rawKeyDown
  end if 
end rawKeyDown
Last edited by PaulDaMacMan on Wed Apr 10, 2024 10:56 pm, edited 1 time in total.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: = character not mapped?

Post by Zax » Fri Mar 29, 2024 9:06 am

Thank you Paul for your answer, and for the PDF document.

I was unable to make your script work, even by replacing the focusedControl with focusedObject.

But this one seems to work, even in the script editor, and it could be a workarround:

Code: Select all

on rawKeyDown pKey
   if (pKey = 65469) then
      if (the selectedChunk <> "") then
         put "=" into the selection
      end if
   else pass rawKeyDown
end rawKeyDown

PaulDaMacMan
Posts: 683
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: = character not mapped?

Post by PaulDaMacMan » Wed Apr 10, 2024 11:00 pm

Zax wrote:
Fri Mar 29, 2024 9:06 am
Thank you Paul for your answer, and for the PDF document.

I was unable to make your script work, even by replacing the focusedControl with focusedObject.

But this one seems to work, even in the script editor, and it could be a workarround:

Code: Select all

on rawKeyDown pKey
   if (pKey = 65469) then
      if (the selectedChunk <> "") then
         put "=" into the selection
      end if
   else pass rawKeyDown
end rawKeyDown
Glad to help.

I'd still like to know where exactly did these particular numbers come from when they were added to the engine.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10075
Joined: Fri Feb 19, 2010 10:17 am

Re: = character not mapped?

Post by richmond62 » Thu Apr 11, 2024 7:58 am

these particular numbers
are in theory Unicode glyph addresses, and MOST of the time LiveCode behaves itself and interprets them as such (otherwise my Devawriter Pro would not work).

HOWEVER, while the number pad on the right-hand side of extended keyboards and F-keys do deliver what should be Unicode glyph addresses, LiveCode (and the OS in general) interprets them differently (hence my earlier reference to 'magic').

'Magic' (in the computer world at least) generally boils down to finding out what was going on in "Fred Flintstone's" head when he was programming the bit of code that results in the difficulty we are having.

If you feel a desperate urge you can find the rawKey codes for ALL the function keys and so on and then pop over to the Unicode consortium's website and look them up: believe me, I did this for an awful lot of writing systems, and developed quite a few fairly entertaining headaches doing so. Recently used two enormous exercise books full of Unicode addresses and fancy symbols from fancy languages to light the living-room fire. 8)

THIS is NOT the problem.

The problem (such as it is) is that the OP is having a 'bad day' insofar as LC doesn't seem to love his keyboard (actually it is probably NOT a problem with his keyboard as he has tried a few of them, but, either what the OS on his machine does with a particular keyDown, or what LC does with is.

The claim (backed up by others) is that the combination of MacOS and a non-English language keyboard does not deliver an '=' to LC when the '=' is pressed on the number pad of those Mac keyboards. The claim is made more complicated by the fact that pressing on the '=' on the number pad in, say, TextEdit or LibreOffice DOES deliver an '=' sign.

So . . . my first question would be:

1. On an English language layout keyboard pressing the '=' on the number pad delivers the raw key code of 65469: ss that the raw key code delivered on a French AZERTY Mac keyboard?

1.1. If the answer is 'No', then the problem probably lies in LC insofar as MacOS will pick up "Wot Ever" from the '=' on the number pad regardless of what type it is (QWERTY, AZERTY, @#$%^&, and so on) and deliver an '=', while LC seems onbly able to do that with QWERTY keyboards.

My first question has already been answered: and the answer is 'Yes'.

So my second question is this:

2. Does LC detect what type of keyboard is connected to a computer, and for the sake of argument, differentiate between a QWERTY and an AZERTY in such a way that it responds differently whan the '=' is pressed on the number pad?

2.1. If the answer is 'Yes' then we need to ask if that is necessary? Does it have effects elsewhere? And if the answer to that one is 'No' the code that differentiates between keyboard types needs to be removed.

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: = character not mapped?

Post by Zax » Thu Apr 11, 2024 9:32 am

At this time, we probably have too many unknowns to better target the cause of the problem.
We would need to find other people with an extended non-QWERTY keyboard (i.e. with a numeric keypad to the right of the alpha keypad).

Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10075
Joined: Fri Feb 19, 2010 10:17 am

Re: = character not mapped?

Post by richmond62 » Thu Apr 11, 2024 11:36 am

Have you tried using the Number Lock key?
-
SShot 2024-04-11 at 13.33.47.png
SShot 2024-04-11 at 13.33.47.png (58.65 KiB) Viewed 1876 times
-
c'est étrange, mais je n'ai pas un difference entre quand le clé est enforcée est né. :?

Excusez-moi pour ma langue "Franglais."

J'ai ein kartoffel im munde. 8)

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: = character not mapped?

Post by Klaus » Thu Apr 11, 2024 1:24 pm

richmond62 wrote:
Thu Apr 11, 2024 11:36 am
...
J'ai ein kartoffel im munde. 8)
:lol: :lol: :lol:

Zax
Posts: 519
Joined: Mon May 28, 2007 10:12 am
Contact:

Re: = character not mapped?

Post by Zax » Thu Apr 11, 2024 1:38 pm

richmond62 wrote:
Thu Apr 11, 2024 11:36 am
Have you tried using the Number Lock key?
Nice try... but try again as the lock key has no effect on my = problem ;)
richmond62 wrote:
Thu Apr 11, 2024 11:36 am
c'est étrange, mais je n'ai pas un difference entre quand le clé est enforcée est né. :?
Hum, oui, cette phrase est assez étrange... please don't tell me my english is so weird :o

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10303
Joined: Wed May 06, 2009 2:28 pm

Re: = character not mapped?

Post by dunbarx » Thu Apr 11, 2024 2:43 pm

The capsLock key, like all the other "control" keys, has no rawKeyDown value.

But am I missing something? The rawKeyDown parameter for the "=" key on my extended keyboard is "61", and on the "=" key at the keypad is "65469".

What is the issue?

Craig

PaulDaMacMan
Posts: 683
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: = character not mapped?

Post by PaulDaMacMan » Thu Apr 11, 2024 4:28 pm

dunbarx wrote:
Thu Apr 11, 2024 2:43 pm
The capsLock key, like all the other "control" keys, has no rawKeyDown value.

But am I missing something? The rawKeyDown parameter for the "=" key on my extended keyboard is "61", and on the "=" key at the keypad is "65469".

What is the issue?

Craig
I think this is incorrect, CapsLock does have a rawKey Value (see the PDF list I posted), although I can't recall now exactly how I arrived at that number, I think is was while playing around with command+option+shift+FKey combinations.

And also these 2-byte ranged numbers are not the same as the unicode (utf-16) numbers.
Last edited by PaulDaMacMan on Thu Apr 11, 2024 4:53 pm, edited 1 time in total.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10303
Joined: Wed May 06, 2009 2:28 pm

Re: = character not mapped?

Post by dunbarx » Thu Apr 11, 2024 4:36 pm

Paul.

Not the first time I have been wrong, but if I place this in the card script:

Code: Select all

on rawkeyDown tKey
   put tKey into fld 1
end rawkeyDown
and start typing, I get values almost everywhere except for what I call the "control" keys, for example, the option key, the shift key and also the Caps lock key.

How did you get a value?

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10303
Joined: Wed May 06, 2009 2:28 pm

Re: = character not mapped?

Post by dunbarx » Thu Apr 11, 2024 4:40 pm

Paul.

Is is possible you are referring to the fact that if one gets rawKey values as one types, that if the caps lock key is down then that value changes to reflect the case of the typed value itself? if so then that is not a value of the caps lock key itself.

Why do I think you did not make this mistake? So how did you get any value at all, and what was it? :?

Craig
Last edited by dunbarx on Thu Apr 11, 2024 5:07 pm, edited 1 time in total.

PaulDaMacMan
Posts: 683
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: = character not mapped?

Post by PaulDaMacMan » Thu Apr 11, 2024 5:02 pm

dunbarx wrote:
Thu Apr 11, 2024 4:40 pm
Paul.

Is is possible you are referring to the fact that if one gets rawKey values as one types, that if the caps lock key is down then that value changes to reflect the case of the typed value itself? if so then that is not a value of the caps lock key itself.

Why do I think you did not make this mistake? So how did you get any value at all, and what was it? :?

Craig
It may also have been while playing around with combinations of evaluate script, possibly mixed with LCB syntax, while working on my on-screen-keyboard widget.

Try this with some of those special key combos:

Code: Select all

on rawKeyDown
  put the keysDown -- should really be property called 'the rawKeysDown' because it's NOT functionally a plural form of the 'on keyDown' param values.
end rawKeyDown
It seems the keysDown is the plural form of getting the first param of the 'on rawKeyDown' handler, which seems like an error in the naming of that engine property (hence my comment), it would be nice if there were an equivalent for the plain text name/char of the keys that are down in a chord, but there isn't.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10303
Joined: Wed May 06, 2009 2:28 pm

Re: = character not mapped?

Post by dunbarx » Thu Apr 11, 2024 5:20 pm

Paul.

Well, well.

Caps Lock - 65509
Shift - 65505
Control - 65507
Option - 65513
Command - 65511

And of course if you have ALL of them down when you hit any other key, you get ALL of them in a comma delimited list. Nothing really new there, of course. So those keys do indeed have a numerical value, it is just that you cannot get that value with what I used to think was the ultimate tool to do so, "rawKeyXXX", to find them.

Well, well.

Craig

Post Reply