How to trap "SHIFT+TAB" with constants?

Post

Posted
Rating:
#1 (In Topic #1280)
Regular
sergioabreu is in the usergroup ‘Regular’
Hi
If I am not wrong (i tested in console debugging) the pressed SHIFT key modifies the TAB key.code in the event.

Is there a way to catch shift tab with constants? I only could with "hardcode" I know that gambas desencourages but… if there is another way, please tell me because:

   

Code

 If key.shift and key.code = Key.tab Then
    or key["TAB"] fail…  The SHIFT key pressed CHANGES the TAB key.code

What is the best approach?

This is why I endorse the "ascii" key codes. Tab keyCode is always 9 with or without Ctrl, Alt of Shift modifiers

Gambas could introduce a KEY.ASCII property … would help a lot
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
Shift and Tab is Key.BackTab that's why the codes differ. They are supposed to, they are 2 different key functions.
On my keyboard there are 2 pictures on my Tab button, one is an arrow going right (Tab) and above it an arrow going left (BackTab)

You would check for Tab or Shift+Tab (BackTab) like this..

Code (gambas)

  1. If Key.Code = Key.Tab Or If Key.Code = Key.BackTab
  2.  

and why need Key.Ascii when there is Asc() command?

Asc(Key.Text) does the same thing

And Print Asc(Key.Text) does not work here for Shift+Tab , only normal tab gives a value of 9, Backtab does not.
Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
sergioabreu is in the usergroup ‘Regular’
 I see only one key that uses a second key as a modifier.
Again, something that nobody would guess.
Looking on documentation, peoples eyes look for  S for SHIFT and T for TAB letters, never heard about a "Backtab".
Your help is precious.  Thanks!
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
Yes, the Tab key is an odd one because there is only .Text with Tab and not BackTab.
so a normal Tab hit acts like an ascii key press with associated \t Char but Shift+Tab is more like a function key like Del/Home/etc.

if you inspect the text with Tab/Shift+Tab press you will find the following..

Print Quote(Key.Text)

"\t"  ' Tab
""  ' BackTab

So this is a case where ascii won't help as BackTab has no ascii character
Online now: No Back to the top
1 guest and 0 members have just viewed this.