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

Re: Scrolling field or datagrid with Native scroller?

Post by Youks » Thu Apr 19, 2012 2:15 pm

Hi all,
A handler was missing in that version so not a neat code but works the same.
I forgot to mention that i am using MobGUI.!
Rgds.
Attachments
Modified_AZIndexDemoV2.livecode.zip
(192.43 KiB) Downloaded 263 times

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

Re: Scrolling field or datagrid with Native scroller?

Post by bn » Thu Apr 19, 2012 9:41 pm

Hi Youks,

thanks for posting your example.

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 » Fri Apr 20, 2012 6:15 am

Couldn't get it to open in LC 5.02. =[

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 » Fri Apr 20, 2012 9:48 am

Hi Fireworx,
Try this one.

Rgds
Attachments
Modified_AZIndexDemoV2.zip
(192.43 KiB) Downloaded 276 times

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

Re: Scrolling field or datagrid with Native scroller?

Post by FireWorx » Sat Apr 21, 2012 7:43 pm

Strong work !!! Just so you know in v LC 5.02 the line of code shown below in the openstack handler Throws an error. However it seems to work fine with it commented out.
Here is the line:
set the compositorType of stack "ScrollerAZIndexDemo" to "opengl"

I looked over your code but was unable to find what happens on: scrollerUpdate "Scroller"

Also

Not exactly sure where all the contacts data is stored and how you pull it out based on the index alpha request to display a subset of the entire list.

Can you elaborate on this a little?

This would be some great stuff for me to use to cross reference an alpha indexed list of streets to their map pages in my mapping application. I do have MobgGui and sadly have not had much luck with it so I would be excited to put the cash outlay to work.

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 22, 2012 12:02 am

Hi Dave,
Basically don't pay attention to that error with set the compositorType of stack "ScrollerAZIndexDemo" to "opengl" it is normal and has no effect when you try it on the simulator because "openGl" is just for the IOS so it triggers that error msg on the IDE.

I have just adapted the original code from Splash21 to suit my need and the "scrollerupdate" is a MobGUI feature that allows you to update the scroller when its content has changed.

Regarding the different lists, they are just on the second card embedded in different field contents (from A to Z) that i refer to when needed.

The big issue with the original code was that if you apply a scroll on the screen and then select another letter, the content of the scroller will update its content but continue scrolling......which is not like the behavior of the native address book. So i tried somehow to get rid of that !

I am sure that my code is not perfect and i hope that it will be improved.

Kind Regards. :D

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

Re: Scrolling field or datagrid with Native scroller?

Post by FireWorx » Sun Apr 22, 2012 9:05 am

If you would like to combine your 26 Alpha indexed fields into just one field for easy maintenance just replace the one line of code.

put fld ("Contacts_"&tIndexChar) of cd "ItemsList" into fld"Contacts"

with

repeat with x = 1 to the number of lines of field "MyContacts" of card 2
if char 1 of line x of field "MyContacts" of card 2 is tIndexChar then
put line x of field "MyContacts" of card 2 & CR after tNewList
end if
end repeat
put tNewList into fld "contacts"
------------------------
Works pretty good here is the stack. PS had to sort the lines starting with "The" into the "T" group.
Dave
Attachments
Scrl AZIndexDemo Mod.zip
(202.53 KiB) Downloaded 284 times

Klaus
Posts: 14235
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Scrolling field or datagrid with Native scroller?

Post by Klaus » Sun Apr 22, 2012 12:02 pm

Hi Dave,

you could also "filter" instead of a repeat loop:
FireWorx wrote: ...
put fld ("Contacts_"& tIndexChar) of cd "ItemsList" into fld "Contacts"
put field "MyContacts" of card 2 int tNewList
filter tNewList with(tIndexChar & "*")
put tNewList into fld "contacts"
...
:-)

Best

Klaus

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

Re: Scrolling field or datagrid with Native scroller?

Post by FireWorx » Sun Apr 22, 2012 4:43 pm

Thanks Klaus,
Yes I like that better.
However so as not to confuse. The first line of your code is the one that is being replaced. So Just have one field rather than 26 and name it "MyContacts" and then the following script.

put field "MyContacts" of card 2 int tNewList
filter tNewList with(tIndexChar & "*")
put tNewList into fld "contacts"

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 22, 2012 6:57 pm

Hi,

Thx Dave & Klaus!

Rgds :D

Post Reply