Page 1 of 2

send Keycode SHIFT+ARROW

Posted: 31 Dec 2018 08:11
by anuraag
Is it possible to select some texts like in windows by pressing shift+arrow keys?

I have tried control ui. But its only moving directional pad instead of selecting text.
sendKey("DPAD_LEFT", "SHIFT_ON")

Re: send Keycode SHIFT+ARROW

Posted: 31 Dec 2018 14:42
by Desmanto
I also face the same problem, can't use Shift + DPad, or any other combination, example Ctrl+C, Ctrl+V. But using bluetooth keyboard, it is working fine.

Try

Code: Select all

sendKey("DPAD_LEFT","SHIFT_ON")
The cursor only move to the left, not selecting the char. Log from KeyEvent

Code: Select all

^ KeyUp:        action=1 code=21 repeat=0 meta=1 scancode=0 mFlags=1024 label='' chars='null' number='' 
Try

Code: Select all

sendKey("DPAD_LEFT","SHIFT_MASK")
also doesn't work, cursor only move left.

Code: Select all

^ KeyUp:        action=1 code=21 repeat=0 meta=193 scancode=0 mFlags=1024 label='' chars='null' number='' 
Try

Code: Select all

sendKey("A","SHIFT_ON")
it sends a capital A, so the shift on actually works. Only not recognized when using with dpad.

Code: Select all

^ KeyDown:      action=0 code=29 repeat=0 meta=1 scancode=0 mFlags=1024 label='A' chars='null' number='' 
^ KeyUp:        action=1 code=29 repeat=0 meta=1 scancode=0 mFlags=1024 label='A' chars='null' number='' 

Re: send Keycode SHIFT+ARROW

Posted: 04 Jan 2019 09:39
by anuraag
CTRL+C, V, A, X working fine here.
Only problem with SHIFT.

Re: send Keycode SHIFT+ARROW

Posted: 05 Jan 2019 06:24
by Desmanto
Oh. Just tested it, Ctrl version works fine. Seems can be useful in certain occassion. I think we also need the multiple meta key version. Something like CTRL+ALT+DEL, essentially 2 or more meta key at once

Re: send Keycode SHIFT+ARROW

Posted: 03 May 2019 04:48
by anuraag
I thought to continue my flow without shift option but now
Ctrl + Z works,
Ctrl + Y doesn't :cry:

Re: send Keycode SHIFT+ARROW

Posted: 03 May 2019 17:38
by Desmanto
In which app, we can use Ctrl + Y ? In keyevent the Y is shown up, but I don't know if it is followed by the CTRL hold down.

Re: send Keycode SHIFT+ARROW

Posted: 04 May 2019 00:19
by anuraag
On Android CTRL+SHIFT+Z is for redo operation. It is working with hacker's keyboard. So we need more than one metakey. Martin? :D

Re: send Keycode SHIFT+ARROW

Posted: 04 May 2019 01:17
by Desmanto
Can't test that one using current sendKey(). Yes, we need additional meta key. Along with additional meta key "MENU" (keycode 82). I just found out that some chrome shortcut require "MENU" key, not "CTRL". It is lucky that the close tab can be done using "CTRL" + "W".

Re: send Keycode SHIFT+ARROW

Posted: 05 May 2019 13:24
by Martin
Hi,

sendKey already allows to use multiple meta keys like this:
sendKey("A", "CTRL_ON", "SHIFT_ON");

The documentation does not mention this capability and the dialog only provides single meta key selection. I'll try to improve both.
I'm not sure why DPAD with SHIFT does not work. I will have to make a few experiments to see if there's a way to make this work. You could use function setSelection to achieve something similar in a less comfortable way.

Regards,
Martin

Re: send Keycode SHIFT+ARROW

Posted: 05 May 2019 17:25
by anuraag
That worked.

I don't know how to get start or end number for setSelection.