KeyCaps
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
KeyCaps
On various Linux distros one has an application called Onboard which has the wonderful
ability to reflect your keyboard layout:
When I use a US English keyboard it looks like this:
- -
and with a Bulgarian one:
- -
I cannot work out whether this sort of thing can be recreated in LiveCode...
ability to reflect your keyboard layout:
When I use a US English keyboard it looks like this:
- -
and with a Bulgarian one:
- -
I cannot work out whether this sort of thing can be recreated in LiveCode...
Re: KeyCaps
I suspect you could recreate it, but I think you'd have to know the key-mappings of a heck of a lot of keyboards/languages.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: KeyCaps
Onboard does not "know" anyone's key mappings: even if one writes one's
own keyboard layout the thing will pick it up.
It is programmed in Python . . . I suppose I'll have to track down the source code
and try to understand that first, and then . . .
own keyboard layout the thing will pick it up.
It is programmed in Python . . . I suppose I'll have to track down the source code
and try to understand that first, and then . . .
Re: KeyCaps
I guess 'key-mapping' doesn't translate to 'key-layout' well, but I'll give it another shot. Not all keyboards are 'querty', or 'dvorak' mapped. Aside from that, you'd have to know how the keys are mapped to the language. The OS itself will give you the layout the user chose (either at setup or at any other point), but that generally doesn't mean your home free.richmond62 wrote: ↑Sat Feb 02, 2019 10:44 pmOnboard does not "know" anyone's key mappings: even if one writes one's
own keyboard layout the thing will pick it up.
An excerpt from Onboards site: Aside from that being a 'custom' layout, I am pretty sure all the ones included were coded as well.
Of course, I could be completely off.
*Edit - or maybe not
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: KeyCaps
The KeyBoard Viewer behaves the same way in macOS.
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: KeyCaps
I wonder if there is a way to fake a keyDown programmatically?
Pseudocode:
send "keyDown" to (rawKey 35)
Pseudocode:
send "keyDown" to (rawKey 35)
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: KeyCaps
Hi.
"KeyDown" is just a message. Make a field and a button, and put this into the button script:
Put this into the field script:
Craig Newman
"KeyDown" is just a message. Make a field and a button, and put this into the button script:
Code: Select all
on mouseUp
send "keyDown 3" to fld 1
end mouseUp
Code: Select all
on keyDown tkey
put tkey after me
end keyDown
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: KeyCaps
I know keyDown is just a message: I've been depending on it for 9 years with my Devawriter Pro.
Hence my use of the word "pseudocode".
Unfortunately LiveCode appears to be 'deaf' to whatever else is going on in an operating system;
or at least insofar as it cannot tell me what character will end up in a field if I hit a certain key
on my keyboard without my actually hitting the thing.
Hence my use of the word "pseudocode".
Unfortunately LiveCode appears to be 'deaf' to whatever else is going on in an operating system;
or at least insofar as it cannot tell me what character will end up in a field if I hit a certain key
on my keyboard without my actually hitting the thing.
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: KeyCaps
ReOpening this after two months.
@Ricmond:
You need do this only once for each keyboard mapping.
Craig
@Ricmond:
You and Bogs have discussed keyboard "mapping. If I understand your original question, why would this not work in a field script:I wonder if there is a way to fake a keyDown programmatically?
Pseudocode:
send "keyDown" to (rawKey 35)
Code: Select all
on keyDown tKey
put remap(tkey) after me
end keyDOwn
function remap tKey
switch tKey
case "a"
return "b"
break
case "b"
return "c"
break
...
end remap
Craig
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: KeyCaps
Craig, that's a thought, but it would involve a full routine for every possible keyboard mapping . . .
The problem is how (if at all) a stack, on loading, can detect the end-user's key-mapping.
For the sake of argument . . . imagine a stack containing a virtual keyboard where
each 'key' is a field, and when the end-user opens that stack each field contains
the symbol relevant to the end -user's standard key-mapping . . .
This is a way to circumvent an end-user having to press each key on his/her keyboard so the stack
can work out the key-mapping.
One of the ways this could be done were if LiveCode could send a fake keyDown to the OS, and the OS
would 'echo' the relevant key to LC.
The problem is how (if at all) a stack, on loading, can detect the end-user's key-mapping.
For the sake of argument . . . imagine a stack containing a virtual keyboard where
each 'key' is a field, and when the end-user opens that stack each field contains
the symbol relevant to the end -user's standard key-mapping . . .
This is a way to circumvent an end-user having to press each key on his/her keyboard so the stack
can work out the key-mapping.
One of the ways this could be done were if LiveCode could send a fake keyDown to the OS, and the OS
would 'echo' the relevant key to LC.
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: KeyCaps
Richmond.
I never thought that the hard coded routine above would be the right way to implement the map. An array stored as a custom property of the stack is the way to do that. And yes, you must create a new array for each "translation". But at least the reverse map comes for free.
Craig
Doesn't this involve the same amount of work, in that a unique "table" must be created for each and every map?. imagine a stack containing a virtual keyboard where
each 'key' is a field, and when the end-user opens that stack each field contains
the symbol relevant to the end -user's standard key-mappin
I never thought that the hard coded routine above would be the right way to implement the map. An array stored as a custom property of the stack is the way to do that. And yes, you must create a new array for each "translation". But at least the reverse map comes for free.
Craig