DataGrid2 - What do you like, what don't you like

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: DataGrid2 - What do you like, what don't you like

Post by jacque » Mon Sep 03, 2018 11:03 pm

I just noticed that if you scroll quickly and the content glides a little after you lift your finger, there is no scrollerEndDrag message. If you scroll deliberately and lift your finger without flicking, then the message is sent.

So it is possible to miss the end of a drag if the user flicks the scroller quickly. In any case, scrollerBeginDrag seems to always be sent reliably.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Tue Sep 04, 2018 7:20 am

Thanks qualcreek, i can give that a try with an test stack.

I hope my stack is not corrupted in any way. As Jacque's test stack works ok with the scrolling field.
What i also notice is, i fetch data from an external DB.
Then on mobile(Android) the DG shows only the rows which fit in the DG, then i switch to another card, then back to the card with the DG, and then it is able to scroll and shows the rest of the rows. In either way it shows me the correct tLinecounter value (via answer).
In IDE it works as expected, it shows all rows directly when scrolling. So that makes it harder to discover where the fault might be.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Tue Sep 04, 2018 6:22 pm

@Jacque

I even see a bunch scrollerDidScroll and a scrollerEndScroll without a scrollerbeginscroll.
Depends indeed on how you move/place/touch it

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: DataGrid2 - What do you like, what don't you like

Post by jacque » Tue Sep 04, 2018 7:47 pm

The behavior you describe happens to me when the initial scroll of the field and the native scroller don't match. Usually I set the scroll of the field to 0 before creating the scroller, which I think you do already. But if the scroll of the field is different on launch then a mismatch could happen. That's all I can think of.

I haven't used a scroller with a datagrid though, so I can't say for sure.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Tue Sep 04, 2018 7:50 pm

I've changed Jacque's teststack and replaced the fld"lorem" for DG2 grp"lorem"
Uncommented everything what had to do with creating the scroller

Then set the scrolbars to auto as Qualcreek mentioned. Used the Form. And added lines of text.
It scrolls but terrible slow and stuttering, and not comparable with the smoothness of the scroller you normally create.

Then i noticed, only scrollerDidScroll comes in the field below and not begin or end.
So how can you write something which will handle that?

I attached the stack so can see for yourself.
Thanks!
DGscrollerTest.zip

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm
Location: McKenna, WA

Re: DataGrid2 - What do you like, what don't you like

Post by quailcreek » Wed Sep 05, 2018 9:53 pm

Sphere,
When you populate the DG, I'm assuming in a PreOpenCard, add this after.
Again, sTheDataGridName is the name of your DG.

The very sluggish scowling with the native scroller has been added to the bug list. Hopefully it will be addressed soon.

Code: Select all

send "RefreshList" to grp sTheDataGridName
Tom
MacBook Pro OS Mojave 10.14

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Thu Sep 06, 2018 12:14 pm

Thanks Jacque and Qualcreek,

i had it all in opencard handler, so changed that to preOpenCard, which is much nicer, as it looks ready right away.

i used ResetList but that is for something else according the dictionary.
So i tried RefreshList like qualcreek said, but which does not seem to do the trick.
The different DG's do show me the nr of rows via an answer command, but only still show me the rows which fit in the DG.
Funny thing is i can see the scroll bar going up and down in the reverse direction of the movement of my finger and by that you can see about how long the grid is (the more rows, the shorter the scrollbar).

Also i stepped back to a DG 8.1.10 version stack(saved lastly on LC8.1.10, never on LC9.x.x).
And i fixed in the test part from Jacque, so i get scollerdidscroll:andthenameofthescroller so thats good, but still not begin or enddrag.

I checked if it was a not LC9.x.x DG, and i can only recoqnize it as only the DG2 has Enable Swipe in the dgProps.
Still not clear about the difference in IDE and mobile.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: DataGrid2 - What do you like, what don't you like

Post by sphere » Thu Sep 13, 2018 6:24 pm

Just to inform, the bug request has now become an enhancement request for the DG2 https://quality.livecode.com/show_bug.cgi?id=21555

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: DataGrid2 - What do you like, what don't you like

Post by marksmithhfx » Thu Aug 26, 2021 2:02 pm

Old thread, but related topic. My questions is, are the edit mode and swipe controls in DG2 compatible? I have been fooling around with Michael's demo stack and I can get swipes to work OR I can get the EditMode controls to work, but I can't get them both to work at the same time. As soon as EditMode is turned on the DG appears to ignore swipe actions.

Has anyone gotten them both to work at the same time?

Thanks
Mark
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

RCozens
Posts: 138
Joined: Thu Aug 05, 2021 6:42 am
Location: Manchester, CA USA

Re: DataGrid2 - What do you like, what don't you like

Post by RCozens » Thu Aug 26, 2021 7:06 pm

Morning All,

Serendipity Editors is my first experience with DG. So far I'm only using a DG table to display pixel settings.

It's a great improvement over the mickey mouse method of displaying columnar data I used in HyperCard (justifying each entry to the column's width & using a non-proportional font). I may or may not convert to it before I release the LiveCode version of my HyperCard app. If the app comes out without the conversion, DGs will be part of the first revision. I will also evaluate using DG forms for record display.

My main concern (which may diminish as I have more experience with DGs) is a lack of understanding how DGs work. This made it hard for me to debug my first DG issues. If you look at a stack with a DG in the Project Browser you will see a substack that is created. If you look at it in the Geometry Manager, you will find an enormous number of objects that are involved in making it work. So interpreting what might be going wrong when debugging is more difficult.

As I write this it occurs to me that a whole lot of what I see in the Project Manage and the Geometry Manager is probably related to DG forms, and that a striped down version for those who only use DG tables would simplify things for them.

Also, so far my experience is limited to one DG in a stack. When incorporated in my app, there will be many. I want to be confident that will work before committing to it.
Rob Cozens dba Serendipity Software Company
Manchester, CA USA

Each new generation gives more attention to the man-made world...
and less attention to the world that made man.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: DataGrid2 - What do you like, what don't you like

Post by dunbarx » Thu Aug 26, 2021 8:48 pm

My favorite thing, "I use dataGrids but don't understand them".

Are you sure that a table field is not suitable? It may not be, as DG's are far more powerful and far nicer to look at. But many have found that a table field is just fine.

Craig

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: DataGrid2 - What do you like, what don't you like

Post by stam » Fri Aug 27, 2021 12:59 am

RCozens wrote:
Thu Aug 26, 2021 7:06 pm
Also, so far my experience is limited to one DG in a stack. When incorporated in my app, there will be many. I want to be confident that will work before committing to it.
Personally i use DGs all the time - they are a bit of a beast to get to grips with initially exactly because they offer so many features and have an extremely rich API. But one you get over that learning curve they are extremely versatile.

Regarding numbers of data grids in an app, that is a complete non-issue. In several of my apps i have at least 1 data grid on almost all cards (and the odd card with as many as 5).

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: DataGrid2 - What do you like, what don't you like

Post by stam » Fri Aug 27, 2021 1:49 am

As an addendum:

As far as i'm concerned there are 2 downsides to DGs:
1. There is a very slight speed penalty compared to tableFields. Not noticeable under normal conditions, but if for example using this to store data that will manipulate lots of graphics and you're then manipulating all the graphics (in my case 16 graphics), I found better performance using a simple tableField. This is not contingent on the number of data grids. However when managing a very large amount of data, the DG performs better as I think it's optimised for this, where tableFields may struggle.

2. The other main issue for me is that you can't safely copy/paste data grids - they are complex groups and its templates are stored in a separate substack, so copy/pasting the data grid does not really create a new object (modifying the template of one will modify all, although you can store different data in each) and it completely fails if you paste to a different stack.

Accepting those limitations, i have not encountered any issue with data grids and indeed use then all the time because a) the row/column template editor is invaluable and b) i often work with data in arrays and this just makes it easier.

A table field is fine for some uses, as Craig mentions.
They do perform ever so slightly faster (they are much simpler creatures) but i think DGs are optimised for handling large amounts of data where the table field may struggle.
Table fields are also a better option if you're going to create complex groups that can be copied to other stacks as you can't really do that with data grids.

As always one should use the right tool for the job. DGs work fine and confidence in these 'working' is not an issue, just learning how to use them.

On that note:
I would recommend a better way to use the documentation - the build in 'dictionary' doesn't allow sub-searching topics and is a major impediment to finding the info you need in complex APIs and the data grid is probably one of the most complex ones.
If you're on a mac, consider splashing out for Dash (https://kapeli.com/dash), if you're on Windows or Linux, you can use the open source Zeal instead (https://zealdocs.org) - these offer great search capability within the actual API (eg you can search for 'dataOf' and it will highlighted dgDataOfLine, dgDataOfIndex etc - pretty much necessary unless you're prepared to pour over the hundreds of methods and properties). James Hale maintains a Dash docset for LiveCode - i've been using that for the better part of a year and warmly recommend.

marksmithhfx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 931
Joined: Thu Nov 13, 2008 6:48 am
Location: London, UK

Re: DataGrid2 - What do you like, what don't you like

Post by marksmithhfx » Sat Aug 28, 2021 10:38 am

stam wrote:
Fri Aug 27, 2021 1:49 am
I would recommend a better way to use the documentation - the build in 'dictionary' doesn't allow sub-searching topics and is a major impediment to finding the info you need in complex APIs and the data grid is probably one of the most complex ones.
If you're on a mac, consider splashing out for Dash (https://kapeli.com/dash), if you're on Windows or Linux, you can use the open source Zeal instead (https://zealdocs.org) - these offer great search capability within the actual API (eg you can search for 'dataOf' and it will highlighted dgDataOfLine, dgDataOfIndex etc - pretty much necessary unless you're prepared to pour over the hundreds of methods and properties). James Hale maintains a Dash docset for LiveCode - i've been using that for the better part of a year and warmly recommend.
Looks interesting Stam, but when I checked the download option, LC was not listed? Any tips for getting started with Dash?

Thanks
M
macOS 12.6.5 (Monterey), Xcode 14.2, LC 10.0.0, iOS 15.6.1
Targets: Mac, iOS

stam
Posts: 2634
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: DataGrid2 - What do you like, what don't you like

Post by stam » Sat Aug 28, 2021 10:51 am

marksmithhfx wrote:
Sat Aug 28, 2021 10:38 am
Looks interesting Stam, but when I checked the download option, LC was not listed? Any tips for getting started with Dash?
Yeh, I've been posting about this quite a lot recently.

LiveCode is available, but you have to drill down to user-contributed docsets and you'll find a LiveCode docset maintained by James Hale (Preferences > Downloads > User Contributed in the top left box > scroll down to LiveCode)

Alternatively, you can get more info and the doscset to import directly from James Hale's git repo: https://github.com/jameshale/Dash-User-Contributions

Or you can create your own - James has created a tool that lets you do this, available here: http://livecodeshare.runrev.com/stack/845/Make-DocSet
He also has created a minimal reader here: http://livecodeshare.runrev.com/stack/913/Docset-Reader

I take particular issue with this situation, as equivalent languages such as XOJO have managed to get their docsets put on the main programming languages section, whereas there seems to be no interest from LiveCode inc. to sort things like these out. This does have an impact on how the language is perceived...

Post Reply

Return to “Talking LiveCode”