Page 1 of 1

Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 1:40 pm
by glenn9
Hi,

I've got a scrollling list field of items on Card A which when an item is tapped, navigates to a linked different card, ie a simple notes app.

As the scrolling list field now contains over a 100 items I was wanting to see if I could code returning to the same item, ie the same position in the scrolling list field, that was tapped when navigating back to card A from another card.

I was hoping the 'thumbposition' command might help but on checking the dictionary and despite this with some trial error, I don't think this is the correct command as I can't seem to put the 'thumbposition' into a variable that I can then reference, to return to a particular position in card A.

It might not even be possible but I just wanted to check!

Many thanks,

Glenn

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 1:48 pm
by elanorb
Hi Glenn

I think you might be looking for the vScroll property, rather than the thumbposition.

I hope that helps.

Elanor

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:05 pm
by richmond62
I would have thought the best idea would be to SAVE the stack just before it navigates to the new card, thereby
preserving the scrollBar at the position it is before going to the new card.
-
Screenshot 2021-02-12 at 15.00.46.png
-
Here's the code in my scrolling list field:

Code: Select all

on mouseUp
   save stack "SHUFFLE"
   put the selectedLine of me into ZZZ
   set the itemDelimiter to " "
   put item 2 of ZZZ into XXX
   put line XXX of fld "scf" into KARD
   go to card KARD
end mouseUp

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:06 pm
by glenn9
Thanks Elanor, that works perfectly!

I've used on card A:

Code: Select all

put the vScroll of field 1 into gScrollPosition

and on card B:

Code: Select all

set the vScroll of field 1 of card A to gScrollPosition
I never ceased to be amazed at how straightforward LC can be, especially for me as a beginner!

Kind regards,

Glenn

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:11 pm
by glenn9
Hi Richmond,

Thanks for the stack, I'll put your solution into my toolbox as well...

Regards,

Glenn

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:30 pm
by Klaus
Saving the stack is of course no option in a runtime!

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:35 pm
by bogs
Klaus wrote:
Fri Feb 12, 2021 2:30 pm
Saving the stack is of course no option in a runtime!
Unless your using the standalone as a launcher for your program stacks... :D

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:45 pm
by Klaus
Sheeeeeeeeesh... 8)

Noone likes wise guys, Sir!

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 2:53 pm
by bogs
Capone did :twisted:

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 3:05 pm
by Klaus
Where do you live again? 8)

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 3:12 pm
by richmond62
Probably somewhere near the bag end of Lake Michigan, I imagine. 8)

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 3:13 pm
by bogs
Endurance impact crater, Mars !

Image

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 3:20 pm
by Klaus
Ah, good for you. :D

Re: Saving the scroll position in a scrolling list field

Posted: Fri Feb 12, 2021 3:45 pm
by bogs
Hee hee :D