odd scrolling behaviour of text field

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
okk
Posts: 176
Joined: Wed Feb 04, 2015 11:37 am

odd scrolling behaviour of text field

Post by okk » Sun Apr 26, 2020 10:00 am

Hi,
I noticed a strange scrolling behaviour of a textfield. When I hit the return key in a field that is already scrolled to the bottom, the field would react with a strange scroll showing the newly created line at the bottom of the field. This behaviour is a bit annoying since I always need to scroll up to read my text, when hitting return again it jumps again down to the bottom. I made an image to illustrate my point. The small red bar is indicating the position of my cursor. Can you replicate this? Is it how it should be or? MacOs12.6. / LC 9.5 indy.
Image

Thanks for any hints.
Best
Oliver

PS. The text is from the infamous S.C.U.M. Manifesto - in case you were wondering....

tperry2x
Posts: 22
Joined: Wed Apr 22, 2020 9:58 pm

Re: odd scrolling behaviour of text field

Post by tperry2x » Sun Apr 26, 2020 11:29 am

Not sure what to suggest here. This is the expected behaviour when I try it:
Image
The new line appears without scrolling the text field to the bottom.

One thing I could think of, where did you copy your text from? Perhaps there's some characters (unicode or something) in the text that livecode doesn't like?

My test is in Livecode Community 9.5.0. Mac OS X 10.11.5

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2718
Joined: Sat Dec 22, 2007 5:35 pm
Location: Genève
Contact:

Re: odd scrolling behaviour of text field

Post by jmburnod » Sun Apr 26, 2020 11:33 am

Hi Oliver,
Tested (LC business 9.5.0, OS X 10.13). Works as expected
Sorry no idea
Best regards
Jean-Marc
https://alternatic.ch

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: odd scrolling behaviour of text field

Post by dunbarx » Sun Apr 26, 2020 6:15 pm

Tested here. LC creates a new line at the insertion point, and all looks normal. This is with random text packed into a single scrolling field.

LC 9.5.1. Mac OS 10.13.4

Craig

okk
Posts: 176
Joined: Wed Feb 04, 2015 11:37 am

Re: odd scrolling behaviour of text field

Post by okk » Fri May 08, 2020 12:53 pm

Hi guys, thanks for testing. I still have the behaviour in various iterations of LC. The text is clean, no special formatting etc. I attach a sample stack. Do as follows:
- open stack
- scroll text field to the bottom (this is important!)
- select before phrase: ""The male is a biological..."
- hit return
in my case the the phrase "The male is a biological..." will appear now on the bottom of the field.
Please tell me that I am not insane...
Thanks.
Oliver
Attachments
scrolltest.livecode.zip
(1.31 KiB) Downloaded 195 times

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: odd scrolling behaviour of text field

Post by dunbarx » Fri May 08, 2020 8:35 pm

Hi.

Did what you said. Put a return before the phrase you mentioned. That portion of the text was set down one line, so that a blank line separated the word "reproduction" from the word "The".

This is what I would have expected. Know that in the original text, the phrase of interest already had a hard return after "reproduction" which is why the empty line appeared between them.

So please tell me again what happens when you do this.

Craig

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: odd scrolling behaviour of text field

Post by dunbarx » Sat May 09, 2020 1:39 am

Hey, is it the scroll that you are talking about, and not the formatting of the text?

That the scroll does not "stay down", that is, since it was at its max before the return, why is it not at the max after? Or at least only one lines's worth of scroll above?

Since all you did was add a return? Well, not sure. But there is always a way to hold the scroll at the bottom after the return, though a kluge. Do you need help with something like that?

Craig

okk
Posts: 176
Joined: Wed Feb 04, 2015 11:37 am

Re: odd scrolling behaviour of text field

Post by okk » Sun May 10, 2020 4:41 pm

Hi Craig,
yes, I was just wondering why the scroll jumps and doesn't stay down when I only insert a Return. My image in the original post explains the behavior I would expect. Can you confirm the behaviour? Is it a bug or intended? I used the follwoing code to work around this behavior, but it is ugly, since the lock screen seems not to work in the rawkeyup handler, so the user sees the jump.

Code: Select all

local currentscroll

on rawkeyDown
   put the scroll of me into currentscroll
   pass rawKeyDown
end rawkeyDown

on rawKeyUp theKey
        if theKey is "65293" then
         lock screen
         if (the formattedheight of me - the height of me - currentscroll) < 50 then  set the scroll of me to currentscroll+20
         unlock screen
    end if
end rawKeyUp
Best
Oliver

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: odd scrolling behaviour of text field

Post by dunbarx » Sun May 10, 2020 10:04 pm

Try this in the field script:

Code: Select all

on returnInField
   put return after  the selectedChunk
   set the scroll of me to 100000
end returnInField
Craig

okk
Posts: 176
Joined: Wed Feb 04, 2015 11:37 am

Re: odd scrolling behaviour of text field

Post by okk » Wed May 20, 2020 1:29 pm

Hi Craig,
thanks, this works. Still I wondering if my observed behaviour is expected or a bug and is it only me. Oliver

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: odd scrolling behaviour of text field

Post by dunbarx » Wed May 20, 2020 4:56 pm

I would bet $1 that it is expected behavior, but for no important reason. I would bet $2 that I am wrong about that.

Craig

okk
Posts: 176
Joined: Wed Feb 04, 2015 11:37 am

Re: odd scrolling behaviour of text field

Post by okk » Wed May 20, 2020 11:53 pm

If I am interpreting you correctly, you actually believe it is a bug, since you bet more money on it? o

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: odd scrolling behaviour of text field

Post by dunbarx » Thu May 21, 2020 3:36 am

Nobody has ever interpreted me correctly.

I am sure everyone sees what you do. I certainly do.

This small but noticeable effect ought to cause others to chime in. Everyone know what the issue is?

Craig

Post Reply

Return to “Talking LiveCode”