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

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

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

Post by quailcreek » Mon Dec 25, 2017 6:54 am

Hi,
I thought I'd start this thread so we can talk about the new DG2 that came with LC 9 dp 11

Overall I think it's a major step in the right direction. I developed my own version similar to this a while ago but DG2 saves me a ton of code and mine doesn't have the reorder capability.

It appears that the auto-scroll feature does not work with DG Tables. It works great on Form DGs.

The main thing that first struck me was the concept of left vs right swipe. In my mind, if I place the cursor on the right side of a row and move to the left, that’s a left swipe and it should reveal the control at the right side of the row. Or do I have things backwards? The Dictionary and the release notes seem a little mixed up.

I like the animate feature it adds a nice touch.

The enable Swipes, I think, should have a setting for Enable/Disable Left and Enable/Disable Right Swipe. Although you can turn them off and on thru code.

The swiping is a little twitchy to me. The row doesn’t always catch the edge of the left an right controls. That is something I’m sure can be adjusted.

I’ve attached a sample stack that I’ve been fooling around with. It's set up for iOS. Please let me know if it’s helpful.
LC 9 DG Test.livecode.zip
(10.16 KiB) Downloaded 331 times
Last edited by quailcreek on Wed Dec 27, 2017 11:27 pm, edited 2 times in total.
Tom
MacBook Pro OS Mojave 10.14

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 » Tue Dec 26, 2017 9:54 pm

A couple of things I've noticed.
1) EditModeReorderCompleted doesn't work, at least I haven't been able to get it to work. It's in the Behavior Script of the DG on cd 1 of the stack.

2) If you open a card with a DG on it and the DG is set up to use DG2 auto scroll there is a problem with edit mode. If you open the app I uploaded in the sim or on a device, and tap the Start Editing btn the 2 editing controls will appear. If you then do a reorder (drag using the control on the right) when the drag is completed you'll get an error. If you first scroll the DG and then do the reorder, then you won't get the error.

I've uploaded an updated stack. This one has the DG I developed a while ago. It also allows a left and right swipe. Let me know what you think.

LC 9 DG Test_02.livecode.zip
(13.49 KiB) Downloaded 342 times
Tom
MacBook Pro OS Mojave 10.14

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

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

Post by MaxV » Wed Dec 27, 2017 3:11 pm

Doen't work at all... Continuous crashes...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Wed Dec 27, 2017 5:13 pm

MaxV wrote:
Wed Dec 27, 2017 3:11 pm
Doen't work at all... Continuous crashes...
I would like to follow the progress on those. What are the bug report numbers?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

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

Post by bogs » Wed Dec 27, 2017 5:20 pm

FourthWorld wrote:
Wed Dec 27, 2017 5:13 pm
I would like to follow the progress on those. What are the bug report numbers?
You can file a bug report for someone else's sample stack not working? I thought Max was referring to the file quailcreek attached, I could be wrong though :|
Image

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 Dec 27, 2017 7:53 pm

MaxV,
My stack requires LC 9.0.0 dp11 and xCode 9.2. Is this what you're running?

The only error I get is the one I described regarding reordering.

Richard,
Have you tested my sample stack?
Last edited by quailcreek on Thu Dec 28, 2017 9:46 pm, edited 1 time in total.
Tom
MacBook Pro OS Mojave 10.14

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Wed Dec 27, 2017 10:56 pm

bogs wrote:
Wed Dec 27, 2017 5:20 pm
FourthWorld wrote:
Wed Dec 27, 2017 5:13 pm
I would like to follow the progress on those. What are the bug report numbers?
You can file a bug report for someone else's sample stack not working? I thought Max was referring to the file quailcreek attached, I could be wrong though :|
Crashes are different from what the OP reported, and considered critical. If the OP isn't seeing the crashes that Max reported here hopefully Max will be able to submit the recipe for those to the bug DB.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Wed Dec 27, 2017 10:57 pm

quailcreek wrote:
Wed Dec 27, 2017 7:53 pm
Richard,
Have you tested my sample stack?
Briefly. Not seeing what you reported, because I'm not seeing anything at all - the DG renders empty on my machine (v9dp11, Ubuntu 14.04).

I'll poke around to see if I can pin down what's happening with this....
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

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

Post by bogs » Wed Dec 27, 2017 11:16 pm

Oh, I see :oops:
Image

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 Dec 27, 2017 11:25 pm

Hi Richard,
My second sample stack has 3 DGs in it. The first uses the DG2 features only.

The second DG is a table DG set to use auto scroll. Not working.

The third uses only the "WorkingRect" from the DG2 stuff. It's in the Behavior Script of the DG. I had to incorporate this to help with the scroll and swipe to keep the controls in the DG positioned correctly. I didn't need anything like that in my DG before DG2 happened.

Are all 3 of the DGs not showing data?

I did have the same issue you mentioned with a form DG not firing the Behavior Script. I beat on the problem for over an hour. Then I recreated the DG using the exact same code and the same controls in the Row Template and viola, it started working. Could be a bug but I haven't tested to see if I can recreate it.

Here are three of the bug reports I've filed:
http://quality.livecode.com/show_bug.cgi?id=20809

http://quality.livecode.com/show_bug.cgi?id=20808

http://quality.livecode.com/show_bug.cgi?id=20799
Tom
MacBook Pro OS Mojave 10.14

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Thu Dec 28, 2017 2:25 am

quailcreek wrote:
Wed Dec 27, 2017 11:25 pm
Are all 3 of the DGs not showing data?
True, none.
I did have the same issue you mentioned with a form DG not firing the Behavior Script. I beat on the problem for over an hour. Then I recreated the DG using the exact same code and the same controls in the Row Template and viola, it started working. Could be a bug but I haven't tested to see if I can recreate it.
I can't recreate it from scratch either, but in the demo you posted none seem to have data. How are those populated?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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 » Thu Dec 28, 2017 3:03 am

One each cd there is a tab delimited, hidden fld named "Awards".

Code: Select all

on preOpenCard
  if  environment() is not "mobile" then exit to top
  put fld "Awards" into tData
  
  put turnRecordsIntoArray (tData) into theArray
  set the dgData of grp "Form_DG" to theArray
  
  send "RefreshList" to grp "Form_DG"
end preOpenCard

function turnRecordsIntoArray pData
  local tHeaders,theKey
  
  put "Name" & tab &"More"  into tHeaders 
  --   replace "xmlerr, can't find element" with "" in theData
  set the itemDelimiter to tab 
  repeat with x = 1 to the number of lines in pData
    repeat with y = 1 to the number of items in tHeaders 
      put item y of line x of pData into theKey[x][item y of tHeaders] 
    end repeat 
  end repeat 
  set the itemDelimiter to comma
  return theKey
end turnRecordsIntoArray 
Tom
MacBook Pro OS Mojave 10.14

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9802
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Thu Dec 28, 2017 6:04 am

Ah, that first line explains it ("exit to top"). With that in place no work can be done on the desktop, everything is limited to having to run on a phone or tablet. I never work that way, so it hadn't occurred to me that the init routine would stop itself when running in LC.

Are all of the new DG features exclusively mobile? That would be a shame. The desktop has become very influenced by mobile design trends, and much of the new DG would be great there.

So now it populates, but I still can't run it - I get an error on line 22 of group "Row Template 003" - "can't find background":
if the vis of grp "DG2 Default Right Swipe Control" OR the vis of grp "DG2 Default Left Swipe Control" then
Also, isn't the turnRecordsIntoArray function what the DG does when you populate it with text rather than an array?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

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 » Thu Dec 28, 2017 6:30 am

Glad you figured it out.

I haven't seen any documentation that would lead me to believe that DG2 is only mobile. You're right, that would be a shame.

Line 22 is only there so I could capture the mouseUp if either of the swipe controls is visible. You can comment out the mouseUp part of the code and see if that allows you to run it. Or check to make sure the names of the swipe control grps match what is there. Maybe they got renamed somehow. I've attached a screen shot of the project browser showing the cd in the datagrid template sub-stack.
Project Browser.png

As I'm sure you know, there are several ways to populate a DG.
Here's another that uses text rather than an array:

Code: Select all

  put fld "Awards" into tData
  
  put "Name" & tab & "Info" & cr into TheTextData
  put tData after TheTextData
  set the dgText [true] of grp "Table_DG" to TheTextData
Tom
MacBook Pro OS Mojave 10.14

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 » Thu Dec 28, 2017 7:01 am

I was just thinking about the swipe grps not being found. I'll bet the swipe capability is mobile only.
Tom
MacBook Pro OS Mojave 10.14

Post Reply

Return to “Talking LiveCode”