View Single Post
Old 07-10-2020, 06:39 AM   #1293
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Location: Black Forest
Posts: 5,054
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
I have a question about intercepting keyboard-messages.

I have this script which opens its own gui-window and I would like to pass all keys through to the Reaper-window except the Enter, ESC and Space-key.
So my script would react to Enter, ESC and Space, where all other keys are redirected to, let's say, the arrangeview, so running all other actions associated with the other keys are still runnable.

Now here's my problem: how can I do that?

Code:
gfx.init()

function main()
  Key=gfx.getchar()
  if Key~=-1 and Key~=13 and Key~=27 and Key~=32 then
    -- What do I need to write in this if-branch?
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("This Key is sent to the Arrangeview")
  else
    reaper.ClearConsole()
    reaper.ShowConsoleMsg("This Key is treated in gfx-window and not sent to Arrangeview")  
  end
  reaper.defer(main)
end

main()
Not at the computer right now, but you would use https://www.extremraym.com/cloud/rea...VKeys_GetState to get the current key state and compare it with the desired values.

Edit, sorry, of course you also need to intercept the keys:
https://www.extremraym.com/cloud/rea...Keys_Intercept
__________________
My Reascripts forum thread | My Reascripts on GitHub
If you like or use my scripts, please support the Ukraine: Ukraine Crisis Relief Fund | DirectRelief | Save The Children | Razom
_Stevie_ is offline   Reply With Quote