Going to a line in a scrollable field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 125
- Joined: Sat Jan 31, 2009 12:01 am
Going to a line in a scrollable field
On the Mac, if I do a "Find" command of a string, the field jumps to that line, but in iOS, in the simulator and the iPad, the foundline doesn't jump to the middle of the scrollable field....
Any solutions?
Any solutions?
Re: Going to a line in a scrollable field
Hi scotttyang,
Maybe this script is useful for you (tested on simulator only):
Best regards
Jean-Marc
Maybe this script is useful for you (tested on simulator only):
Code: Select all
on shSearchInFld pSearch
put the num of chars of pSearch into tNbC
put trunc(the height of fld 1/2) into tH
put fld 1 into tText
put offset(pSearch,tText) into tOff
put the formattedHeight of char 1 to tOff of field 1 into tFH
set the scroll of fld 1 to tFH-tH
select char tOff to tOff+ tnbc-1 of fld 1
end shSearchInFld
Jean-Marc
https://alternatic.ch
-
- Posts: 125
- Joined: Sat Jan 31, 2009 12:01 am
Re: Going to a line in a scrollable field
Thanks! The concept generally works. The problem is, maybe it's a bug for me, as my scroll field is in a group, so I have to
set the scroll of group "grpscrollingfield" to 500
BUt when I scroll the field, it jumps back to its original scroll position prior to the "set the scroll of the group"
Doesn't make sense to me.
I may have to take this feature out of the App, until I figure it out...as the app is already at the AppStore waiting for review, and have a few more days to fix this...the jumping back to previous scroll point!
Scott
set the scroll of group "grpscrollingfield" to 500
BUt when I scroll the field, it jumps back to its original scroll position prior to the "set the scroll of the group"
Doesn't make sense to me.
I may have to take this feature out of the App, until I figure it out...as the app is already at the AppStore waiting for review, and have a few more days to fix this...the jumping back to previous scroll point!
Scott
-
- Posts: 125
- Joined: Sat Jan 31, 2009 12:01 am
Re: Going to a line in a scrollable field
it does seem it is the ...
scrollerDidscroll pOffsetX,pOffsetY
that is resetting the scroll after finding a word in the field to the previous scroll position. .... not sure how to get around this...with the scrollerDidscroll, scroller doesn't work....hmmm...
scrollerDidscroll pOffsetX,pOffsetY
that is resetting the scroll after finding a word in the field to the previous scroll position. .... not sure how to get around this...with the scrollerDidscroll, scroller doesn't work....hmmm...
Re: Going to a line in a scrollable field
Can you post your stack, that will be to easy help you
https://alternatic.ch
-
- Posts: 125
- Joined: Sat Jan 31, 2009 12:01 am
Re: Going to a line in a scrollable field
See the attached stack. It's basically a very basic scroll stack. Below are buttons A to H. Clicking on the Letter buttons cause the scroller to jump the the Letter, setting it to the top. BUT...........if you try to scroll again, it jumps the list to the previous vScroll. So it is a bit awkward...WIll need to use in the simulator
- Attachments
-
- scroller search.livecode.zip
- finding string in ios scroller
- (8.52 KiB) Downloaded 246 times
Re: Going to a line in a scrollable field
Hi,
The problem is in the "alphasearch" handler
put
instead
and it work like you want
Best
Jean-Marc
The problem is in the "alphasearch" handler
put
Code: Select all
iphoneControlSet scrollid2, "vscroll", vS
Code: Select all
set the scroll of group "scrollgroup" to vS
Best
Jean-Marc
https://alternatic.ch
-
- Posts: 125
- Joined: Sat Jan 31, 2009 12:01 am
Re: Going to a line in a scrollable field
oh that did it! thanks! would not have figured that out easily myself!