Page 1 of 1

Can I tab text in a field

Posted: Thu Apr 26, 2018 7:56 pm
by thatkeith
I'd like to enter text in a field and be able to type tabs to add basic tab structure. I have a field with tabStops set and it works perfectly in LC, but of course when I try and enter text in the browser version, hitting the tab key tabs out of the field. Any ideas?

k

ADDED CLARIFICATION: this is in the HTML5 output. It works jes' fine in LC, just not in the HTML5 'app'

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 7:57 pm
by FourthWorld

Code: Select all

on tabKey
   put tab into the selection
end tabKey

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 8:05 pm
by thatkeith
Hmm. Tried it in the field script and I'm afraid it doesn't work. :-/

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 9:32 pm
by richmond62
Here's a thought:

Code: Select all

on tabKey
   put (numToCodePoint(32) && numToCodePoint(32) && numToCodePoint(32)) into the selection
end tabKey

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 10:20 pm
by FourthWorld
thatkeith wrote:
Thu Apr 26, 2018 8:05 pm
Hmm. Tried it in the field script and I'm afraid it doesn't work. :-/
That is a strange anomaly; I've used that snippet at least a hundred times over the years.

Which LC version, and which OS?

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 10:43 pm
by bogs
Well in 6.5 (linux) it "works", but I had to hit the tab key twice for it to go. In 7, same thing, although it seemed a bit random (sometimes it went, sometimes it was just a space on the first tabKey), and in 8.1.4 it didn't go no matter how many times I hit the tab key. Just for grins, I tested it back to Mc 2.5, usually you got the tab on the second tabKey.

I put the code directly into the fields script, is it supposed to be elsewhere?

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 10:50 pm
by thatkeith
FourthWorld wrote:
Thu Apr 26, 2018 10:20 pm
Which LC version, and which OS?
LC 9.0 RC 1, Mac OS 10.13.4, Safari 11.1.

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 10:56 pm
by thatkeith
bogs wrote:
Thu Apr 26, 2018 10:43 pm
Well in 6.5 (linux) it "works", but I had to hit the tab key twice for it to go
Remember this is HTML5 output in a browser, generated from LC 9 in the latest Safari on Mac. Hitting the tab key cycles the focus between the field in the LC HTML5 app, something unclear (the main page?), and the browser's address field.

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 11:15 pm
by thatkeith
richmond62 wrote:
Thu Apr 26, 2018 9:32 pm
Here's a thought:

Code: Select all

on tabKey
   put (numToCodePoint(32) && numToCodePoint(32) && numToCodePoint(32)) into the selection
end tabKey
Nice. Although I need actual tabs rather than tabs simulated with spaces, and it doesn't work in the browser environment anyway. I also tried numToCodePoint(9) to attempt to script the insertion of a tab, and numToCodePoint(35) to insert a hash and then replace that with tab. Anything I do is scuppered by the tab key event being caught by the browser and used to switch focus rather than insert a character, no matter what works as expected in LC itself.

I hope there's a workaround and I hope it's possible to bring the HTML5 output more in line with the other outputs in future. :-/

k

Re: Can I tab text in a field

Posted: Thu Apr 26, 2018 11:58 pm
by FourthWorld
Sounds like the browser is eating the tab keyboard message. May warrant a bug report.

Re: Can I tab text in a field

Posted: Fri Apr 27, 2018 3:20 am
by bogs
thatkeith wrote:
Thu Apr 26, 2018 10:50 pm
FourthWorld wrote:
Thu Apr 26, 2018 10:20 pm
Which LC version, and which OS?
LC 9.0 RC 1, Mac OS 10.13.4, Safari 11.1.
My bad, please continue :oops:

Re: Can I tab text in a field

Posted: Fri Apr 27, 2018 8:27 am
by richmond62
Dunno if, by trapping the rawKey code for the TAB key (err . . . might not work on a Mac), you
can pre-empt the TAB key:

Code: Select all

on rawKeyUp RUP
   if RUP = 65289 then
      put tab into the selection
   else
      pass rawKeyUp
      end if
end rawKeyUp
Come to think of things it might be better to use rawKeyDown to ensure that gets "there" first.

Re: Can I tab text in a field

Posted: Tue May 08, 2018 8:45 pm
by thatkeith
Nice try, but the browser wins. :-/
It doesn't even tab through available fields in the card; it jumps straight out to some invisible browser focus on the first tab, then to the address bar on the second, then back to the point where the cursor was in the original LC card field on the third.

It's something that does need fixing. For now I can see no workaround.

Re: Can I tab text in a field

Posted: Mon May 21, 2018 11:11 am
by [-hh]
This will be, even for some modifier keys, always be an unsolved problem with the HTML5 standalone builder because different browsers will have different precedence settings for special keys.

Until now you can't even use modifier-clicks with the HTML5 standalone builder. Or use in a control's script "if the shiftkey is down".

As a workaround for your current problem you could write "\t" in your field "myField" and then by some other action that works in all browsers, for example via a button, fire

Code: Select all

replace "\t" with tab in field "myField"