Setting up DataGrid Scroller

This is the place to get technical support and discuss all things to do with MergEXT

Moderators: FourthWorld, heatherlaine, Klaus, robinmiller, monte

Post Reply
William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Location: Palo Alto, CA put williamdjamieso into tEmail / put n@gmail.com after tEmail/ revmail tEmail
Contact:

Setting up DataGrid Scroller

Post by William Jamieson » Sat Jan 04, 2014 11:39 pm

Hello, I am new to using merge software and was hoping I could get a little advice in getting the Merge DataGrid Scroller set up and working on my Livecode.

I am running Livecode Commercial 6.5. I have Droptools open. I have Merge Datagrid Scroller open. I have a new stack I created for testing. DataGrid Helper is also running if that makes a difference.

Here is what I did:
I noticed that nothing on the Merge Datagrid Scroller stack was clickable or drag-able, so I went to the application browser and copied the group "MergeDataGridScroller" into my blank stack. I then wrote a card script to populate the DG with 100 lines of text. I then set the dgData of the datagrid to my array. I then created two buttons, one to populate the datagrid and one to empty it. I went into the datagrid template and set the default text of field "label" to "default".

Here is what happened:
In development I will press the button that populates and 100 lines of emptiness will appear. The default text did not appear nor did the text that was entered by the script. The datagrid could still be scrolled by moving the scrollbar with the mouse for all 100 lines. When deployed to android it was the same. The scrollbar worked fine, there were 100 lines populated with emptiness. Only, there was no ability to scroll through the lines with touch swiping.

Any suggestions on what to do and why the datagrid scroller is hiding the text and not allowing the android device to scroll. I am also unfamiliar with droptools and am wondering if there is something specific that needed to be done with the droptools stack before copying the datagrid group over to my stack.

Attached is a zip file of the really simple stack I created.

Thanks in advance for your help to anyone reading this. I am super stoked to get this working for my project!

-Will
Attachments
stack1.zip
(10.13 KiB) Downloaded 1005 times

Klaus
Posts: 13864
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Setting up DataGrid Scroller

Post by Klaus » Sun Jan 05, 2014 2:20 pm

Hi Will,

this has nothing to do with MergEXT!

You only need to set the TYPE of your datagrid to TABLE, which it obviously is!
And maybe add a new column, and everything should start to work correctly immediately :D


Best

Klaus

William Jamieson
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 212
Joined: Fri Feb 01, 2013 1:31 am
Location: Palo Alto, CA put williamdjamieso into tEmail / put n@gmail.com after tEmail/ revmail tEmail
Contact:

Re: Setting up DataGrid Scroller

Post by William Jamieson » Sun Jan 05, 2014 5:32 pm

Thanks for looking into this Klaus. You're the best!

I apologize if this is the wrong area of the forum. I just saw that there was another post about the merge datagrid scroller in this same forum so I thought this would be the right place. Where would you suggest I make a post on this topic if there were a next time?

Also, I tried your advice Klause. I can get the text to show up if I set the datagrid as a table. I don't really want a table. A table will work however because they are not too much different, (at least with a little bit of work). But either way, my main issue is still present. I notice that the datagrid does not scroll using touch swipe gestures on my android device.

I have not tried iOS. But I am pretty sure Monte included native Android functionality and a backup script if neither of them worked. So would you be able to look at the wrapping group in my stack or maybe my methods to see if there are any errors? That would be really cool.

(Also, is it normal to not be able to move or drag and drop anything on the Merge stack? It seems like you are supposed to by the way the instructions are worded.)

Any help would be much appreciated.

Thank you Klaus and fellow Livecoders!

-Will

Klaus
Posts: 13864
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Setting up DataGrid Scroller

Post by Klaus » Sun Jan 05, 2014 6:13 pm

Hi Will
William Jamieson wrote:I apologize if this is the wrong area of the forum. I just saw that there was another post about the merge datagrid scroller in this same forum so I thought this would be the right place. Where would you suggest I make a post on this topic if there were a next time?
this is the correct place, only one part of your problem, the one I spotted immediately, was LC related :D
William Jamieson wrote:Also, I tried your advice Klause. I can get the text to show up if I set the datagrid as a table. I don't really want a table. A table will work however because they are not too much different, (at least with a little bit of work).
Unless you do not modify the ROW TEMPLATE they are basically the same, yes.
No idea why it does not update in the monent.
William Jamieson wrote:I have not tried iOS. But I am pretty sure Monte included native Android functionality and a backup script if neither of them worked. So would you be able to look at the wrapping group in my stack or maybe my methods to see if there are any errors? That would be really cool.
I have no idea, did not use MergExt until now :D

I usually script everything by hand, here a script for creating a scroller for a datagrid (card script):

Code: Select all

local sScrollerID

## Create scroller now:
on opencard
   create_scroller
end opencard

on closecard
   delete_scroller
end closecard

command create_scroller   
   put "DataGrid 1" into tScrollerGroup
   
   if the environment <> "mobile" then
      exit create_scroller
   end if
   
   ## Create native scroller object and save its ID in a local variable
   MobileControlCreate "scroller"
   put the result into sScrollerId
   
   ## RECT is the area on the card where the SCOLLER should do its work
   MobileControlSet sScrollerId, "rect", (the rect of grp tScrollerGroup)
   
   put the width of grp tScrollerGroup into tWidth
   put the dgFormattedheight of grp tScrollerGroup into tHeight
   set the dgvScroll of grp tScrollerGroup to 0

   ## WHAT part fo the datagrid shall be scrolled-> the complete datagrid
   MobileControlSet sScrollerId, "contentRect", (0,0,tWidth,tHeight)
   
   ## Display SCROLLER
   MobileControlSet sScrollerId, "visible", "true"
   
   ## the typical BUMP effect when you ge to the edge of the object
   MobileControlSet sScrollerId, "canBounce", "true"
   MobileControlSet sScrollerId, "pagingEnabled", "false"
   
   MobileControlSet sScrollerId, "vIndicator", "false"
   MobileControlSet sScrollerId,  "borderStyle", "none"
   
     MobileControlSet sScrollerId, "canScrollToTop", "false"
end create_scroller

## Will be sent when the user actually SCROLLs with his finger
on scrollerDidScroll OffsetX, OffsetY
   lock screen
   set the dgvScroll of grp "DataGrid 1" to OffsetY
   unlock screen
end scrollerDidScroll

## REMOVE natove object when card closes!!!!!
command delete_scroller
   if the environment <> "mobile" then
          exit delete_scroller
   end if
     MobileControlDelete sScrollerId   
end delete_scroller
Replace "DataGrid 1" with the name of your datagrid and you can copy/paste the script to your card
I have not tried iOS. But I am pretty sure Monte included native Android functionality and a backup script if neither of them worked. So would you be able to look at the wrapping group in my stack or maybe my methods to see if there are any errors? That would be really cool.
No, sorry, I will not go through 500+ lines of other peoples code voluntarily 8)


Best

Klaus

monte
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1564
Joined: Fri Jan 13, 2012 1:47 am
Contact:

Re: Setting up DataGrid Scroller

Post by monte » Mon Jan 06, 2014 12:10 am

Hi Will
William Jamieson wrote:Here is what I did:
I noticed that nothing on the Merge Datagrid Scroller stack was clickable or drag-able, so I went to the application browser and copied the group "MergeDataGridScroller" into my blank stack. I then wrote a card script to populate the DG with 100 lines of text. I then set the dgData of the datagrid to my array. I then created two buttons, one to populate the datagrid and one to empty it. I went into the datagrid template and set the default text of field "label" to "default".,
William Jamieson wrote: In development I will press the button that populates and 100 lines of emptiness will appear. The default text did not appear nor did the text that was entered by the script. The datagrid could still be scrolled by moving the scrollbar with the mouse for all 100 lines. When deployed to android it was the same. The scrollbar worked fine, there were 100 lines populated with emptiness. Only, there was no ability to scroll through the lines with touch swiping.
I had a quick look at your stack and basically you need to learn how to work with a data grid and probably DGS and DropTools are confusing things at this point. My suggestion is to start here http://lessons.runrev.com/s/3527/m/data ... -data-grid and work through the lessons. DGS works best with forms rather than tables. For mobile tables I'd actually recommend the runrev planet table as the datagrid was never designed for mobile tables. Once you get the hang of the data grid then the DGS part is easy ;-)

@Klaus you will get very bumpy scrolling with that script. You need to wrap the dg in an extra group then expand it to it's full height then scroll the wrapper group. Use accelerated rendering and scrolling layer mode.

Cheers

Monte
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Klaus
Posts: 13864
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Setting up DataGrid Scroller

Post by Klaus » Mon Jan 06, 2014 1:40 am

Hi Monte,
monte wrote:@Klaus you will get very bumpy scrolling with that script. You need to wrap the dg in an extra group then expand it to it's full height then scroll the wrapper group.
hm, scrolls in fact very smooth here 8)
monte wrote:Use accelerated rendering and scrolling layer mode.
Yes, I do.


Best

Klaus

Zryip TheSlug
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 163
Joined: Tue Jan 26, 2010 10:15 pm
Contact:

Re: Setting up DataGrid Scroller

Post by Zryip TheSlug » Wed Jan 08, 2014 8:26 pm

Hi Will,

It was a long time I'm not had a look to the forum...

Inside DGH we have ready to use scripts for adding an iOS scroller to a datagrid and for managing native fields when editing the datagrid cells. (auto-capitalization, auto-correction, selection point magnification are supported)

In DGH, go to the iOS topic and install the "iOS Scroller & Native Fields script".



Regards,
Zryip
TheSlug
http://www.aslugontheroad.com - Tutorials, demo stacks and plugins for LiveCode
Data Grid Helper - An intuitive interface for building LiveCode's Data Grids
Excel Library- Extends the LiveCode language for controlling MS Excel

Post Reply

Return to “MergEXT”