Can I tab text in a field

Bringing your stacks to the web

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 231
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Can I tab text in a field

Post by thatkeith » Thu Apr 26, 2018 7:56 pm

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'
Last edited by thatkeith on Thu Apr 26, 2018 11:20 pm, edited 1 time in total.
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6210
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Can I tab text in a field

Post by FourthWorld » Thu Apr 26, 2018 7:57 pm

Code: Select all

on tabKey
   put tab into the selection
end tabKey
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 231
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Can I tab text in a field

Post by thatkeith » Thu Apr 26, 2018 8:05 pm

Hmm. Tried it in the field script and I'm afraid it doesn't work. :-/
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2786
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Can I tab text in a field

Post by richmond62 » 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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6210
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Can I tab text in a field

Post by FourthWorld » Thu Apr 26, 2018 10:20 pm

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?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

bogs
Posts: 2371
Joined: Sat Feb 25, 2017 10:45 pm

Re: Can I tab text in a field

Post by bogs » 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. 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?
Image

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 231
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Can I tab text in a field

Post by thatkeith » 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.
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 231
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Can I tab text in a field

Post by thatkeith » Thu Apr 26, 2018 10:56 pm

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.
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 231
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Can I tab text in a field

Post by thatkeith » Thu Apr 26, 2018 11:15 pm

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
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 6210
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Can I tab text in a field

Post by FourthWorld » Thu Apr 26, 2018 11:58 pm

Sounds like the browser is eating the tab keyboard message. May warrant a bug report.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

bogs
Posts: 2371
Joined: Sat Feb 25, 2017 10:45 pm

Re: Can I tab text in a field

Post by bogs » Fri Apr 27, 2018 3:20 am

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:
Image

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2786
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: Can I tab text in a field

Post by richmond62 » Fri Apr 27, 2018 8:27 am

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.

thatkeith
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 231
Joined: Mon Mar 01, 2010 7:13 pm
Location: London, UK

Re: Can I tab text in a field

Post by thatkeith » Tue May 08, 2018 8:45 pm

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.
Senior Lecturer, LCC (University of the Arts London)
Technical Editor, MacUser (1996-2015)
President, IVRPA.org

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1808
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: Can I tab text in a field

Post by [-hh] » Mon May 21, 2018 11:11 am

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"
shiftLock happens

Post Reply

Return to “HTML5”