Scrolling field or datagrid with Native scroller?

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Scrolling field or datagrid with Native scroller?

Post by Youks » Thu Apr 05, 2012 12:53 am

Hi All,

I've been reading all the posts regarding scrolling (datagrid & the rest), but i am still lost (sorry)!

I am having a list of 4600 items that i want to see through a scroller (scripted or MobGui one) indexed like the address book,for which any line can be clickable.

I looked to the samples but none of them allows me to scroll through the entire list.

What is to date, the best method to achieve that smoothly!(datagrid with scroller or scrolling field with scroller) using the new rendering option.

This is the last part of my app that i have to tweak now before submission since i am not happy with the use of the normal scrolling field box.(I am using LC 5.5 GM3,MobGui, App intended for Iphone Touch,3G,4S and Ipad).

Thx as usual for Great help! :D

Jellicle
Posts: 453
Joined: Thu Feb 24, 2011 11:07 am

Re: Scrolling field or datagrid with Native scroller?

Post by Jellicle » Thu Apr 05, 2012 2:38 am

I don't have such huge lists (my longest is about 2000 lines) but I use a browser control and the lists are html files styled with iPhone CSS to do my lists. See my app The George Hrapp to see what is possible with this method - try listing all tweets on the Tweet screen. I have a small bug in the item selection highlight but generally it works well.

Cheers

Gerry
14" MacBook Pro
Former LiveCode developer.
Now recovering.

gpb01
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Sat Jun 04, 2011 5:41 pm

Re: Scrolling field or datagrid with Native scroller?

Post by gpb01 » Thu Apr 05, 2012 7:06 am

Youks wrote:Hi All,
I've been reading all the posts regarding scrolling (datagrid & the rest), but i am still lost (sorry)!

I am having a list of 4600 items that i want to see through a scroller (scripted or MobGui one) indexed like the address book,for which any line can be clickable.

I looked to the samples but none of them allows me to scroll through the entire list.
....
I Youks,
I don't know if RunRev has solved the problem on LC 5.5 (... I'm still on SnowLeopard using LC 5.0.2) but, for sure, up to LC 5.0.2 there is a serious bug on the 'iOS Native Scroller' (... confirmed to me by an exchange of emails with the support) ...

I too have very big list in 'iOS Native Scroller' (... tens of thousands of lines coming from databases) and I discovered that ...
... who implemented 'iOS Native Scroller' has probably made the mistake to use for the 'scroller height' a ... 16 bit signed integer :shock:

This means that, when the height of your scroller (height in pixel of one line x number of lines) in pixel is more than 32767, it produces an overflow and the scroller stop to work :(

At moment, the only solution that I found is to do not use MobGui, to use directly the LC iOS Native Functions and to use a 'scale factor' ...

1. calculate the total height (height of a single line x number of lines)
2. if > 32000 the scaleFactor is the height / 32000 and the scroller height is fixed to 32000
3. on the 'on scrollerDidScroll' you set the dgVScroll NOT to the OffsetY but to the OffsetY * scaleFactor

In this way you scroll minimum of scaleFactor pixels but your scroller never exceeds the 32767 value ;)

I hope I was clear ... not so easy to explain ... :?

Guglielmo

Addendum : I just verified in the 'Quality Center' and the bug 9899 seems to have been resolved in LC 5.5.0-dp1 :)

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Thu Apr 05, 2012 11:21 am

Thx Jellicle & Guglielmo for your answers.

So i will avoid using Mobgui Scroller and try Guglielmo's option.
By the way i am still having the problem of the scroller not working when changing cards even though i am destroying the scroller in the "closecard" handler but once again it might be a MobGui issue. I will try to script it manually and see what it is the result.

King regards. :D

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Scrolling field or datagrid with Native scroller?

Post by FireWorx » Fri Apr 06, 2012 5:55 pm

You have to delete and then re-create the scroller every time you leave and return to the card. Also note that your scroller id will be different every time you recreate the scroller. I have three scrollers on one card and the first time I created them the scroller id's were 1,2,3. I thought I could write code based on that in repeat loops etc but NO. The next time I returned to the card the id's were 4,5,& 6. So if your using a global variable to hold your scroller id's you are going to have problems unless you account for this.
Dave

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Sun Apr 08, 2012 1:03 am

Hi All,

Thx for your help! I modified the address book stack example with Mobgui which looks much better and convenientl than the native scrolling field and as a walkaround, since my list contains 4600 items i just inject into the scroller field the required data stored in a "data card" (24 fields containing each A items, B items etc..) when pressing any letter.
With the accelerated rendering everything works perfectly as wanted but i am facing a little problem: what is the best option to stop immediately a list being scrolled in order to change it?

In other terms which command can we use to stop directly a scrolling (UI Scoller)? work on the "scroll drag" msg ?

Thx.

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Mon Apr 09, 2012 10:13 pm

Any Help? :)

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Scrolling field or datagrid with Native scroller?

Post by FireWorx » Tue Apr 10, 2012 8:44 am

How about

set the unboundedHScroll of group "TheGroupBeingScrolled" to false
set the unboundedVScroll of group "TheGroupBeingScrolled" to false

See if that works

Dave

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Tue Apr 10, 2012 11:53 am

Thx Fireworx for reply but that didn't work.

Let me explain what i want to achieve.

I am having a scrollerAtoZ stack (Mobgui example) modified to suit my needs in terms of displaying my items alphabetically.In other terms when i click on "A" the code import the data field "A" (containing all items starting with A) into the field(scrolling field in static mode) of group the "scroller "which is updated (formatedHeight) and an "update scroller" applied. All is working nicely up to that.(My list being of 4600 items i found this walkaround being enough for me)

Now my problem is when a touch the list (applying for example touch to scroll down) and then touch for example the "B" letter to display the items of list "B", the new list is updated correctly but continues so scroll with the residual deceleration which is not what i want obviously. I would like to achieve the following:

----- If (list_Is_being_scrolled) AND touch_The_letter_sensed then
(Stop_that_previous scroll) and (display_New_List_To_Top)
------- End if

Sorry for the typo above but it is just for clarity. :lol:

Thx Again! :D

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Sat Apr 14, 2012 10:51 pm

No one on This? :wink:

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Sun Apr 15, 2012 1:17 pm

Solved after couple of days of testing! :wink:

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4178
Joined: Sun Jan 07, 2007 9:12 pm

Re: Scrolling field or datagrid with Native scroller?

Post by bn » Sun Apr 15, 2012 4:13 pm

Hi Youks,

I tried it and did not get it to stop scrolling. Would you mind sharing your solution?

Kind regards

Bernd

FireWorx
Posts: 362
Joined: Wed Sep 07, 2011 9:39 pm

Re: Scrolling field or datagrid with Native scroller?

Post by FireWorx » Mon Apr 16, 2012 5:09 pm

Cant the user just put his finger on the scrolling field to get it to stop spinning and then once it is stopped touch the alpha in the sidebar to go to the desired scroll spot? That seems to me to be consistent with most scrolling IOS applications. What did you end up doing?

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Thu Apr 19, 2012 9:36 am

Hi All,

Sorry i've been on a duty travel, just got back yesterday and i will try to upload my stack today! :D

Youks
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 135
Joined: Mon Sep 05, 2011 6:08 pm

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Thu Apr 19, 2012 11:50 am

Hi All,

Here is my code, not perfect though and maybe lots of errors in it but does exactly what i want!! :D

I modified the original with few lines and added a data card containing fields (A to Z lists), i've just taken alphabetical movie list for the example.
By the way in this example i am not handling any line selection in the scrolling list field of the first card,i am just emphasizing on getting close to the native address book behavior in terms of scrolling handling.

Please feel free to correct it or improve it.

Regards.

PS: the stack is saved in legacy mode (2.7)
Attachments
Modified_AZIndexDemo.livecode.zip
(192.42 KiB) Downloaded 361 times

Post Reply