CTRL+Z question

Announcements, questions
Post Reply
darkestdream
Posts: 2
Joined: 19 Aug 2018, 10:08

CTRL+Z question

Post by darkestdream » 19 Aug 2018, 10:28

Hi all,

I'm facing some difficulties mapping CTRL+Z on my bluetooth keyboard.

This is the hardware I'm using:
https://images-na.ssl-images-amazon.com ... SX466_.jpg

What I would like to do is to map the CTRL+Z combo on the "(" key.
When the "(" key is pressed, the hardware sends 16 and 57.
My first attempt to solve the problem:

Code: Select all

-- shift down
lmc_set_handler('BTKEY',16,1,function(button, direction)
  shift=true
end)

-- shift up
lmc_set_handler('BTKEY',16,0,function(button, direction)
  shift=false
end)

-- ( to CTRL+Z
lmc_set_handler('BTKEY',57,1,function(button, direction)
  if(shift == true) then lmc_send_keys("^z")
  end
end) 
The above code unfortunately sends CTRL+SHIFT+Z (tested on notepad++)

I changed the direction:

Code: Select all

-- shift down
lmc_set_handler('BTKEY',16,1,function(button, direction)
  shift=true
end)

-- shift up
lmc_set_handler('BTKEY',16,0,function(button, direction)
  shift=false
end)

-- ( to CTRL+Z
lmc_set_handler('BTKEY',57,0,function(button, direction)
  if(shift == true) then lmc_send_keys("^z")
  end
end) 
But this time the code doesn't work at all . No response on notepad++, No response on https://unixpapa.com/js/testkey.html

I tried to remove the CTRL key. With direction 1 it sends an uppercase Z while with direction 0 it sends a lowercase Z.

I'm a little bit confused. Can someone help me?

Thanks in advance

D.

darkestdream
Posts: 2
Joined: 19 Aug 2018, 10:08

Re: CTRL+Z question

Post by darkestdream » 19 Aug 2018, 11:48

The following code solves the problem

Code: Select all

-- shift down
lmc_set_handler('BTKEY',16,1,function(button, direction)
  shift=true
end)

-- ( to CTRL+Z
lmc_set_handler('BTKEY',57,0,function(button, direction)
  if(shift == true) then
  lmc_send_keys("^z")
  shift=false
  end
end)  

Post Reply