Page 1 of 1

iOS scroller script from DG Helper

Posted: Wed Jul 09, 2014 9:44 pm
by quailcreek
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

Re: iOS scroller script from DG Helper

Posted: Wed Jul 09, 2014 10:13 pm
by Simon
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

Re: iOS scroller script from DG Helper

Posted: Wed Jul 09, 2014 10:25 pm
by Zryip TheSlug
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,

Re: iOS scroller script from DG Helper

Posted: Wed Jul 09, 2014 11:07 pm
by quailcreek
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

Re: iOS scroller script from DG Helper

Posted: Wed Jul 09, 2014 11:08 pm
by quailcreek
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

Re: iOS scroller script from DG Helper

Posted: Mon Aug 31, 2015 10:50 pm
by quailcreek
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?

Re: iOS scroller script from DG Helper

Posted: Mon Aug 31, 2015 11:14 pm
by quailcreek
So, I commented out "mobileControlSet tCurrentScrollerID, "visible", true" the that fixed the mouseUp handler in the behavior being carried out. But now no scroller.