iOS scroller script from DG Helper

Moderators: heatherlaine, kevinmiller, robinmiller, Zryip TheSlug

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

iOS scroller script from DG Helper

Post by quailcreek » Wed Jul 09, 2014 9:44 pm

I posted this before in the iSO forum but didn't get any response. I know this has a simple answer. Here’s the rundown. iPhone app running in the sim. I’ve been using the datagrid scroller from mergExt and it works fine. I’m trying to see if I can get the iOS datagrid scroller script that comes with DG Helper to work. The reason I like DG Helpers version is because it scrolls the data in the DG and leaves the headers in place. OK… so here’s the story. I can get the DG Helper code to work if the DG is per-populated in the LC stack before it launches to the sim. However, what I need to do is populate it on the fly. Trouble is that the DG won't scroll right after it's populated. If I go to another card and come back it will scroll. I’ve tried dispatch refreshList to grp “DGxxx” after populating the DG but no-joy. Anyone have an answer?

Thanks in advance.
Tom
Tom
MacBook Pro OS Mojave 10.14

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am
Location: Palo Alto

Re: iOS scroller script from DG Helper

Post by Simon » Wed Jul 09, 2014 10:13 pm

Hi Tom,
it scrolls the data in the DG and leaves the headers in place.
You can cheat and just use an image of the headers laid on top :)
Maybe save some headaches.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: iOS scroller script from DG Helper

Post by Zryip TheSlug » Wed Jul 09, 2014 10:25 pm

Hi Tom,

The iOS scroller created by DGH is calculated to be egal to the formattedHeight of the datagrid. When the number of rows changed (so when you are populating the datagrid), you need to refresh the scroller by sending the "DGHiOS_DefineScroller" message to the datagrid group.

Example:

Code: Select all

set the dgData of grp "myDatagrid" to tTheData
send "DGHiOS_DefineScroller" to grp "myDatagrid"

Best,
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

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

Re: iOS scroller script from DG Helper

Post by quailcreek » Wed Jul 09, 2014 11:07 pm

Simon wrote:Hi Tom,
it scrolls the data in the DG and leaves the headers in place.
You can cheat and just use an image of the headers laid on top :)
Maybe save some headaches.

Simon
I thought about that, Simon. I'd like to avoid clutter if I can.

Tom
Tom
MacBook Pro OS Mojave 10.14

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

Re: iOS scroller script from DG Helper

Post by quailcreek » Wed Jul 09, 2014 11:08 pm

Zryip TheSlug wrote:Hi Tom,

The iOS scroller created by DGH is calculated to be egal to the formattedHeight of the datagrid. When the number of rows changed (so when you are populating the datagrid), you need to refresh the scroller by sending the "DGHiOS_DefineScroller" message to the datagrid group.

Example:

Code: Select all

set the dgData of grp "myDatagrid" to tTheData
send "DGHiOS_DefineScroller" to grp "myDatagrid"

Best,
Thanks, Zryip. That works.. but then you knew that already.

Tom
Tom
MacBook Pro OS Mojave 10.14

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

Re: iOS scroller script from DG Helper

Post by quailcreek » Mon Aug 31, 2015 10:50 pm

Hi,
I’ve been using the DGH DG scroller code a long time. It still works fine in LC 6.x.x which is where I’ve been building my apps. I’ve started looking a LC V8 and discovered that this doesn’t work there. So I tried it in LC 7.0.6 and it doesn’t with there either.

Here’s the scenario.
I have a DG form scrolling vertically. I populate the DG then set the height of the DG based upon the height of the stack so it fits the device properly.

Code: Select all

on preOpenCard
   if environment() is "mobile" then --exit preOpenCard
      put "SELECT RoutineName, RoutineID, RoutineType from MyRoutines" into tSQLStatement
      put revDataFromQuery(tab,cr, (the uDatabaseID of this stack) ,tSQLStatement) into tData
      sort tData
      
      set the itemDel to tab
      ###################################
      put "Name"  & tab & "ID" & tab &"Type" & cr into TheTextData
      set the dgText [true] of grp "routineList_DG" to TheTextData & tData
      ###################################
      
      ## This is where the trick list is stored for the search
      set the uPropOrigText of this cd to tData
 
      lock screen
      
      put the height of this stack -149 into tHeight
      set the topleft of grp "routineList_DG" to 0,100
      set the height of grp "routineList_DG" to tHeight
      
      ## Create the Search input Control
      inputCreator "Search", "input", "Search_Rect", "TRUE", "TRUE", "None", "No", "Default”,”Default,,”Left"
      mobileControlSet "Search", "textColor", 250,250,250
      mobileControlSet "Search","text", "Search"
      
      dispatch "SortDataByKey" to grp "routineList_DG" with "Name", "text", "ascending", "false"
      send "DGHiOS_DefineScroller" to grp "routineList_DG"

      unlock screen
   end if
end preOpenCard
There is a mouseUp handler in the behavior of the DG to navigate to a given card.

If the data is enough to fill the DG so it’s longer than the what is displayed I can scroll the DG and then the mouseUp from the behavior is carried out.

If I don’t scroll the DG first or if the data is not large enough to over-fill the DG then the mouseUp in the behavior is not carried out.

If I comment out the DGH scroller script in the DG, then everything works except of course I can’t scroll.

Any thoughts?
Tom
MacBook Pro OS Mojave 10.14

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

Re: iOS scroller script from DG Helper

Post by quailcreek » Mon Aug 31, 2015 11:14 pm

So, I commented out "mobileControlSet tCurrentScrollerID, "visible", true" the that fixed the mouseUp handler in the behavior being carried out. But now no scroller.
Tom
MacBook Pro OS Mojave 10.14

Post Reply

Return to “Data Grid Helper”