Page 1 of 1

Scroling a field while user types?

Posted: Sun Nov 16, 2014 6:45 am
by EssoAir
Hey,

I was writing this simple game and ran into a problem that I understand, but don't know how to solve in LiveCode.

Heres the script: https://dl.dropboxusercontent.com/u/122 ... e.livecode

The part I'd like to highlight is this:

Code: Select all

on scrollMe
   if stillScrolling = 1 then
      set the scroll of me to the scroll of me + 1
      wait 1 millisecond
      scrollMe
   end if
end scrollMe
Why is it that this causes the whole program to be useless until it inevitably throws an error (due to scrolling past the actual limit of the scrollable area)

I'm not asking about error handling. I'm saying Id like people to be able to type into the bottom field while the top one is being automatically scrolled. How can this be done?

Re: Scroling a field while user types?

Posted: Sun Nov 16, 2014 7:10 am
by Simon
Hi EssoAir,
Well you actually almost had it right... the right idea but try this
send "scrollMe" to me in 1 millisec
the wait you have blocks all.

Now that 1 millisec is waaayyyyyy too short, and is the reason for that recursion error, not the end of the scrolling fld. The screen hasn't finished updating before it gets about a billion more scrollme's.
You are going to have to play with the +1 px and the time to get what you want.

And I have the fix for getting you out of your scroll loop :)

Simon

Re: Scroling a field while user types?

Posted: Sun Nov 16, 2014 8:23 am
by EssoAir
Simon wrote:Hi EssoAir,
Well you actually almost had it right... the right idea but try this
send "scrollMe" to me in 1 millisec
the wait you have blocks all.

Now that 1 millisec is waaayyyyyy too short, and is the reason for that recursion error, not the end of the scrolling fld. The screen hasn't finished updating before it gets about a billion more scrollme's.
You are going to have to play with the +1 px and the time to get what you want.

And I have the fix for getting you out of your scroll loop :)

Simon
But the error isn't the problem. The problem is the act itself blocks any other interaction with the application. How can I have both things run simultaneously?

EDIT: Ok nm I did the fix and it works. LiveCode is very strange. I come from such a Javascript mindset that this stuff doesn't click with me as easy.

Thank you!