Native Scroller problems in IOS

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Native Scroller problems in IOS

Post by cusingerBUSCw5N » Fri Sep 20, 2019 11:08 pm

I have a scroller that refuses to work in IOS. I have taken these steps:

1) Verified that I declared local sScrollerID
2) I have verified that there are no remaining scrollers from the prior card, using

Code: Select all

 put mobileControls() into tControlList
   answer tControlList& " is mobilecontrollist"
in preopenstack.

3) I have verified that the initial scroller on that page (which is a scrolling datagrid) is deleted when I click the "message" button.

4) I have verified that when I choose the type of message, it creates a scroller (for a group) and has a ScrollerID.

4) I have verified that the size of the contentrect and the scrollerrect are reasonable.

But when I try to scroll on it (in IOS simulator), it never "hits" ScrollerDidScroll. I know that because I put a tag:

Code: Select all

 put "bob" into field "test"
when it gets to ScrollerDidScroll. This tag works for the other scrollers.

What else can I do to make this work?

Here is the createScroller code (this works, because I get an sscrollerID)

Code: Select all

  if the platform is "iphone" or the platform is "ipad" then
         if "loremscroll" is among the lines of mobileControls() then mobileControlDelete "loremscroll"
         --
         
         // Only create a scroller on a mobile device
         if environment() is not "mobile" then exit createscroller
         
         // Set the area of the scroller
         put the rect of group "group_message" into tScrollerRect
         
         // Set the are of the content to be scrolled
         put 0,0,(the formattedWidth of group "group_message"),(the formattedHeight of group "group_message") into tContentRect
         
         // Create the scroller control
         mobileControlCreate "scroller", "loremScroll"
         put the result into sScrollerID
         answer sScrollerID
         // Set the properties of the scroller
         mobileControlSet "loremScroll", "rect", tScrollerRect
         mobileControlSet "loremScroll", "contentRect", tContentRect
         mobileControlSet "loremScroll", "visible", true
         mobileControlSet "loremScroll", "scrollingEnabled", true
         mobileControlSet "loremScroll", "vIndicator", true
         mobileControlSet "loremScroll", "vScroll", 0  
         answer sScrollerID
         end if
Here is my ScrollerDidScroll code (it never gets to the second line - put "bob" into field "test")

Code: Select all

on scrollerDidScroll hOffset, vOffset
   put "bob" into field "test"
   if the vis of group "datagrid_contacts" is true then
      put "1" into field "test"
      lock screen
      set the dgvScroll of grp "datagrid_contacts" to vOffset
      unlock screen  
   else if the vis of group "group_access" is true then
      put "2" into field "test"
      set the vScroll of group "group_access" to vOffset
   else if the vis of group "group_newcontact" is true then
      put "3" into field "test"
      set the vScroll of group "group_newcontact" to vOffset
   else if the vis of group "groupupdateit" is true and the vis of group "group_message" is false then
      put "4" into field "test"
      set the vScroll of group "groupupdateit" to vOffset
   else if the vis of group "group_message" is true then
      put "5" into field "test"
      set the vScroll of group "group_message" to vOffset
   else
      put "6" into field "test"
      end if
   end scrollerDidScroll hOffset, vOffset  
Thanks!

cusingerBUSCw5N
Posts: 339
Joined: Wed Jul 11, 2012 9:24 pm

Re: Native Scroller problems in IOS

Post by cusingerBUSCw5N » Sat Sep 21, 2019 2:34 am

The answer is that you have to set the height and top of the group right before you create the scroller. I had created it on opencard, instead of at the same place I created the scroller.

Worked for Android...but IOS didn't play nice.

Post Reply

Return to “iOS Deployment”