Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 10-15-2018, 09:37 AM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default 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?

Last edited by Meo-Ada Mespotine; 01-19-2023 at 01:13 PM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 10-15-2018, 09:51 AM   #2
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,117
Default

Looking into this. For the euro symbol, what keyboard layout are you using?
Justin is offline   Reply With Quote
Old 10-15-2018, 10:15 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

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...
Meo-Ada Mespotine is offline   Reply With Quote
Old 10-15-2018, 10:36 AM   #4
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,117
Default

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.
Justin is offline   Reply With Quote
Old 10-15-2018, 10:44 AM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

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)?
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-12-2020, 04:02 PM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

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.
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-12-2020, 04:22 PM   #7
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,370
Default

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.
heda is offline   Reply With Quote
Old 11-13-2020, 03:35 AM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

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...
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-13-2020, 12:21 PM   #9
chrisfr
Human being with feelings
 
Join Date: May 2018
Posts: 13
Default

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...
chrisfr is offline   Reply With Quote
Old 11-13-2020, 12:56 PM   #10
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

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...
Meo-Ada Mespotine is offline   Reply With Quote
Old 11-13-2020, 01:08 PM   #11
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 16,117
Default

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.
Justin is offline   Reply With Quote
Old 11-13-2020, 05:39 PM   #12
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

Is there something we could we could do to fish for some helpful things with the worms(to stay within this metaphor )?
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-09-2021, 08:54 AM   #13
vitalker
Human being with feelings
 
vitalker's Avatar
 
Join Date: Dec 2012
Posts: 13,632
Default

Still here.
vitalker is online now   Reply With Quote
Old 03-10-2021, 06:59 AM   #14
BartR
Human being with feelings
 
BartR's Avatar
 
Join Date: Oct 2014
Location: Somewhere in this universe or so.
Posts: 1,818
Default

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
BartR is online now   Reply With Quote
Old 03-10-2021, 01:22 PM   #15
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,761
Default

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.
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-10-2021, 01:54 PM   #16
BartR
Human being with feelings
 
BartR's Avatar
 
Join Date: Oct 2014
Location: Somewhere in this universe or so.
Posts: 1,818
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
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.
Excellent. I was talking right about this solution with another Studio Owner. I was thinking to a thing like gfx.GetCharEx(), so any compatibility issue wth the past, can be left.
__________________
Reaper: always the most up-to-date.
O.S.: Windows 11 Pro
ReaPack (with bilingual Tutorials): https://bit.ly/ReaPack_Repository
BartR is online now   Reply With Quote
Old 05-28-2022, 08:45 AM   #17
BartR
Human being with feelings
 
BartR's Avatar
 
Join Date: Oct 2014
Location: Somewhere in this universe or so.
Posts: 1,818
Default

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
BartR is online now   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:31 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.