How to cause a TextEdit to accept "TAB" key without changing focus?

322 views
Skip to first unread message

Jason Custer

unread,
Jun 2, 2020, 8:53:27 PM6/2/20
to DroidScript
Hey there. Quick question.

Working on a text editor. I want the tab key to insert "\t". I managed to make this happen, but tab also changes focus. From what I can see, I can't use txtEdit.SetOnKey, so I catch keys from the whole app.

Can I cancel a key event? Is there any way to do this?

Thanks in advance!

Kallikratidas

unread,
Jun 2, 2020, 9:06:51 PM6/2/20
to DroidScript
I don't remember the key name of the tab (try use app.SetOnKey(function (action, name, code){}); and press it to find it), but you can just use app.DisableKeys("");//list. For example: VOLUME_UP,VOLUME_DOWN

Jason Custer

unread,
Jun 2, 2020, 10:06:06 PM6/2/20
to DroidScript
@Kallikratidas, Thanks!

I read about DisableKeys somewhere, but I thought my app wouldn't get any key events from that key. As you said, it does.

My TextEdit is in Tab happiness land!

Thank you.

LEVIATHAn

unread,
Jul 8, 2023, 1:34:21 AM7/8/23
to DroidScript
Diagnostic and fix any bugs and run any new updates please and thank you 

Aibdullah “A-Y-A” BR

unread,
Aug 26, 2023, 6:22:22 AM8/26/23
to DroidScript
 chenge Every every twelve houer

Tanya Jackson (T's DeliveryandMore580!)

unread,
Dec 17, 2023, 3:17:06 AM12/17/23
to DroidScript
window.addEventListener("keydown", (event) => {
  if (event.key === "Tab") {
    event.preventDefault();
    // insert "\t" into the text editor
  }
});


Reply all
Reply to author
Forward
0 new messages