Return in field where it's told not to happen

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Return in field where it's told not to happen

Post by rumplestiltskin » Wed Mar 21, 2018 9:41 pm

Alrighty, my lot in life is to find bugs...

I have three fields in a stack. None of the fields have any handlers in them. All three have "Tab on Return" and "Don't Wrap" checked. Yet, if I type something into any of the fields and press the Return key (the one in the main part of the keyboard above right-shift), a return char is added and the text I entered moves upward. This behavior persists regardless of the settings of "Tab on Return" and "Don't Wrap". The tab key works as expected but I need to intercept bad user behavior.

IIRC, in previous versions of LC, these field settings were respected. Do I need to add some sort of "returnInField" handler to each field and, if so, what would I have the handler do?

Thanks,
Barry

LC 8.1.9 Indy.

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Return in field where it's told not to happen

Post by Klaus » Wed Mar 21, 2018 9:53 pm

Hi Barry,

a quick test confirmed this issue! :-/

But looks like the bug has already been reported, so I added a comment:
http://quality.livecode.com/show_bug.cgi?id=20948

Best

Klaus

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: Return in field where it's told not to happen

Post by rumplestiltskin » Wed Mar 21, 2018 9:57 pm

Hello, Klaus! Thanks for your reply. I read your comment at the bug page.

Until the LC crew fixes this, what would you recommend I use as a handler to intercept the "return" and send the focus to the next field?

Thanks,
Barry

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

Re: Return in field where it's told not to happen

Post by bogs » Wed Mar 21, 2018 10:23 pm

Just a guess, but probably something like (not tested)

Code: Select all

on returnInField
	put tab after field "yourField"
end returnInField
Image

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: Return in field where it's told not to happen

Post by rumplestiltskin » Wed Mar 21, 2018 10:25 pm

Just read your replay as I was about to post this:

Code: Select all

on rawKeyDown pkey
   if pkey is 64293 then
      exit rawKeyDown
   else
      pass rawKeyDown
   end if
end rawKeyDown pkey
64293 is the raw code for "Return"

Seems to work but I'll try yours as it's certainly less verbose.

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: Return in field where it's told not to happen

Post by rumplestiltskin » Wed Mar 21, 2018 10:27 pm

bogs wrote:
Wed Mar 21, 2018 10:23 pm
Just a guess, but probably something like (not tested)

Code: Select all

on returnInField
	put tab after field "yourField"
end returnInField
Nope; just adds a tab character to the end of the current field. Mine seems to work okay.

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: Return in field where it's told not to happen

Post by rumplestiltskin » Wed Mar 21, 2018 10:34 pm

rumplestiltskin wrote:
Wed Mar 21, 2018 10:27 pm
bogs wrote:
Wed Mar 21, 2018 10:23 pm
Just a guess, but probably something like (not tested)

Code: Select all

on returnInField
	put tab after field "yourField"
end returnInField
Nope; just adds a tab character to the end of the current field. Mine seems to work okay.
Nope, I thought it was working but no more. *sigh* I'll keep trying.

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Return in field where it's told not to happen

Post by LiveCode_Panos » Wed Mar 21, 2018 10:39 pm

Does that work in your use case?

Code: Select all

on returnInField
   focus on fld "myNextField"
end returnInField
Panos
--

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Return in field where it's told not to happen

Post by Klaus » Wed Mar 21, 2018 10:41 pm

This seems to work:

Code: Select all

on returnInField
 type TAB
end returninfield

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

Re: Return in field where it's told not to happen

Post by bogs » Wed Mar 21, 2018 10:49 pm

rumplestiltskin wrote:
Wed Mar 21, 2018 10:27 pm
bogs wrote:
Wed Mar 21, 2018 10:23 pm
Just a guess, but probably something like (not tested)

Code: Select all

on returnInField
	put tab after field "yourField"
end returnInField
Nope; just adds a tab character to the end of the current field. Mine seems to work okay.
My bad, I misinterpreted what you were shooting for, totally on me, I thought you wanted to add a tab at the end instead of a return :oops: What Klaus said though :D
Image

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

Re: Return in field where it's told not to happen

Post by FourthWorld » Wed Mar 21, 2018 10:55 pm

Barry, what is the height of the field, and what is the textHeight of the field?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: Return in field where it's told not to happen

Post by rumplestiltskin » Wed Mar 21, 2018 11:02 pm

Klaus wrote:
Wed Mar 21, 2018 10:41 pm
This seems to work:

Code: Select all

on returnInField
 type TAB
end returninfield
Yep! That did it. Restores proper behavior. One the bug has been eliminated, I can eliminate this extra code but it's nice to know it will continue working even if I forget.

Simple solution. The best ones often are.

Thanks again!

Barry

PS - I was posting and the forum advised me of a new post so here are the answers:

put Height of field c1 returns 29
put textHeight of field c1 returns nothing
(You probably meant "effective textHeight" and that returned 21)
In the field object properties, it shows a textHeight of 21 ("fixed") and a test size of 16.
Hope this is meaningful.

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

Re: Return in field where it's told not to happen

Post by FourthWorld » Wed Mar 21, 2018 11:57 pm

rumplestiltskin wrote:
Wed Mar 21, 2018 11:02 pm
PS - I was posting and the forum advised me of a new post so here are the answers:

put Height of field c1 returns 29
put textHeight of field c1 returns nothing
(You probably meant "effective textHeight" and that returned 21)
In the field object properties, it shows a textHeight of 21 ("fixed") and a test size of 16.
Hope this is meaningful.
Meaningful, but not as helpful as I'd hoped. I was hoping to reproduce the problem, but here, using v9dp1 on Ubuntu 14.04,fields set to those metrics behave as expected. I wish I had something more useful to offer for what you're seeing.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

rumplestiltskin
Posts: 222
Joined: Wed Jun 21, 2006 7:33 pm
Location: West of the Pecos
Contact:

Re: Return in field where it's told not to happen

Post by rumplestiltskin » Thu Mar 22, 2018 4:50 am

I don't know if this is meaningful or not but I just discovered I had somehow made the three fields in my stack invisible but, just as strange, had selected "Show invisible objects"; so my fields (though "visible" was unchecked) were showing up and displaying that bizarre behavior that caused me to start this thread. I discovered this a few minutes ago when, inexplicably, the three fields disappeared. I figured they had somehow become invisible so I used the "Show invisible objects" menu item and then checked the "visible" checkbox for each field. I saved everything, quit LC, and double-clicked my stack to re-launch LC and open things. Now the expected (non-buggy) "Return-in-field-yields-a-tab-to-the-next-field" behavior seems to be consistently fine.
{a few minutes pass while I check some other things...}

Okay, now I've tried this with checking and unchecking the "resizable" checkbox in the stack's properties and I'm finding the problem ("returns" generating new lines in the field) if I check the checkbox. If I leave the "resizable" checkbox unchecked, this seems to be working properly now.

I'll note my original thought (see paragraph 1, above) did not include the "resizable" checkbox but, indeed, that stack -was- set to be resizable. Once I unchecked it, it looks like it's working properly.

So I'll let Klaus and others whose pay grade is much higher than mine test this. Maybe I got lucky and zeroed in on the issue? Heck; even a stopped watch is correct twice a day! :lol:

Klaus
Posts: 13824
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Return in field where it's told not to happen

Post by Klaus » Thu Mar 22, 2018 3:24 pm

Please take a look at my last comment for that bug!
http://quality.livecode.com/show_bug.cgi?id=20948

The expalantion is really not straightforward, but the observed behavior is definitively correct, once you understand what is going on. Create a ONE line text field with AUTOTAB and see yourself. :D

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”