10-15-2018, 09:37 AM | #1 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
Fixed: gfx.getchar() - Bugs AltGr still a problem...
I've found some issues with gfx.getchar.
When hitting F10, it will return the code twice, unlike all other keys, where it returns the code once, waits a moment before returning the second keystroke. The following code reproduces it on Reaper 5.941 and Reaper 5.96 sucessfully. I'm using Windows 7Pro, with a naked Reaper 5.96 and SWS installed. Code:
gfx.init() function main() A=gfx.getchar() if A>=1 then reaper.ShowConsoleMsg(A.."\n") end if A~=-1 then reaper.defer(main) end end main() There's also an issue with the Euro-currency symbol € This returns two codes, 261 and 128. Is this intentional? Are there other characters that can be returned that way?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people Last edited by Meo-Ada Mespotine; 01-19-2023 at 01:13 PM. |
10-15-2018, 09:51 AM | #2 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 16,117
|
Looking into this. For the euro symbol, what keyboard layout are you using?
|
10-15-2018, 10:15 AM | #3 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
German(Germany) layout.
Oh, it can't be typed into the IDE neither, so I need to read it from the outside to show it in drawstr-functions currently...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
10-15-2018, 10:36 AM | #4 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 16,117
|
Thanks. The F10 issue was an easy fix, the euro key, a lot more difficult, haven't figured it out yet (alt-gr handling on Windows is a mystery to me at the moment ... Oddly other alt-gr combinations seem to work here, hmph.
|
10-15-2018, 10:44 AM | #5 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
I hope, you can get this working at some point
BTW, is there any limitation in gfx-functions in regards of codepages? Or can I use UTF8, UTF16 and so on without a problem(with setting an appropriate font first)?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
11-12-2020, 04:02 PM | #6 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
New reports about the alt-gr issue can be found here:
https://forum.cockos.com/showpost.ph...3&postcount=36 Seems like it's on french keymaps too. gfx.getchar seems to return two characters in these cases, not one unlike most of the others.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
11-12-2020, 04:22 PM | #7 |
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,370
|
AltGr is the combination of Ctrl+Alt so AltGr+E for € symbol, you can also use Ctrl+Alt+E
maybe that gives a hint, however, Ctrl+E is 5 and Alt+E is 325 not 261 and 128, so I don't know. |
11-13-2020, 03:35 AM | #8 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
I have the suspicion, that the € is stored as an UTF16-character and therefore returns two numbers.
Could this be a logical assumption? I have no idea really about the whole Unicode-stuff...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
11-13-2020, 12:21 PM | #9 |
Human being with feelings
Join Date: May 2018
Posts: 13
|
I tried to hack a dirty fix :
https://forum.cockos.com/showpost.ph...5&postcount=43 I'm not sure how it can behave on a non french keyboard, and unfortunately that does not help for the € sign... |
11-13-2020, 12:56 PM | #10 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
I tried a similar approach back then when trying to get the € symbol to work.
But this only worked some of the time, not always. I never found out, why that was. I even went so far to insert it from another file but it failed parts of the time. I somehow suspected an UTF-encoding problem. Means, the lua-file must be stored somehow as UTF-encoded file otherwise the script as well as the returns by gfx.getchar and the displaying by gfx.drawstr wouldn't work properly. I never managed to confirm that theory and never managed to actually produce a script, that shows that behavior and one that doesn't. That was where I left the bug-hunting back then...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
11-13-2020, 01:08 PM | #11 |
Administrator
Join Date: Jan 2005
Location: NYC
Posts: 16,117
|
The issue isn't a UTF one, it has to do with the complex handling of multi-key sequences and dead keys, which is a huge can of worms.
|
11-13-2020, 05:39 PM | #12 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
Is there something we could we could do to fish for some helpful things with the worms(to stay within this metaphor )?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
03-09-2021, 08:54 AM | #13 |
Human being with feelings
Join Date: Dec 2012
Posts: 13,632
|
Still here.
|
03-10-2021, 06:59 AM | #14 |
Human being with feelings
Join Date: Oct 2014
Location: Somewhere in this universe or so.
Posts: 1,818
|
Here I find the topic Mespotine told me yesterday. Yes it still here.
Facts: using CTRL+ALT or AltGr, it's not different. Strange things occurs On my Belgian Keyboard, the "=" key is the same "~" and "+". To get "~" I have to use AltGr+ThatKey or CTRL+ALT+ThatKey While the "+" = SHIFT+ThatKey here what I get: First time digiting: = Then pressing any other key: ~ OR First time digiting: = Second time digiting: ==~~ If I remove the "IF" condition that limits the characters to the pure ANSI ones, at least I can enter accented letters. However the ALTGR works (badly) also within the limitations of the c >=0x20 and c<=0x7E
__________________
Reaper: always the most up-to-date. O.S.: Windows 11 Pro ReaPack (with bilingual Tutorials): https://bit.ly/ReaPack_Repository |
03-10-2021, 01:22 PM | #15 |
Human being with feelings
Join Date: May 2017
Location: Leipzig
Posts: 6,761
|
Maybe it's better, if we would get a gfx.getchar2-function, which simply returns the typed character, depending on the currently used keymap.
With an additional boolean retval, which signals, if a character is utf8-only, so we can use Lua's utf8-functions to deal with them. This number-thing of gfx.getchar is too much of a hassle for non-english-keymap users and maybe it's a good idea to move to something properly instead, that could also support chinese characters, russian characters, emojis, etc. This is a real mess currently and all possible hacks we try introduce worse edgecases. So maybe, gfx.getchar is simply a dead horse we're riding.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - ReaGirl - a GuiLib for guis working for blind people |
03-10-2021, 01:54 PM | #16 | |
Human being with feelings
Join Date: Oct 2014
Location: Somewhere in this universe or so.
Posts: 1,818
|
Quote:
__________________
Reaper: always the most up-to-date. O.S.: Windows 11 Pro ReaPack (with bilingual Tutorials): https://bit.ly/ReaPack_Repository |
|
05-28-2022, 08:45 AM | #17 |
Human being with feelings
Join Date: Oct 2014
Location: Somewhere in this universe or so.
Posts: 1,818
|
Meo-Ada asked me from this post https://forum.cockos.com/showthread.php?t=267149 to write here.
I don't use ALT GR at all since my keyboard is Belgian (Dutch) and has accents already. No one of these keys is working. BTW: beside this, today I noticed that there still some buggy behavior also in the exporting importing file. But it will be argument for another post
__________________
Reaper: always the most up-to-date. O.S.: Windows 11 Pro ReaPack (with bilingual Tutorials): https://bit.ly/ReaPack_Repository |
Thread Tools | |
Display Modes | |
|
|