"selectionChanged" handler in native scroller

Getting into LiveCode for iOS? Ask your questions here.

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
Posts: 22
Joined: Wed Nov 21, 2018 8:27 pm

"selectionChanged" handler in native scroller

Post by rcmills » Tue Jun 11, 2019 7:35 pm

I am having difficulty in capturing a selectionChanged message in an iOS native scrolling field, when it is locked. My handler works when there is not enough text in the field to need the scroller to activate scrolling (text not filling entire field rectangle), but when it does, even if I try using a scroll lock flag to exit the scrollerDidScroll handler immediately, the message doesn't get trapped by my handler. Any ideas of how to do this?

Code: Select all

global scrollLock

on mouseDown
   put true into scrollLock
end mouseDown

on selectionChanged
   wait until the mouse is up
   put the selectedChunk into tChunk
   if word 2 of tChunk < word 4 of tChunk 
      answer "Choose color" with "Red" or "Blue" or "Yellow" or "Clear" as sheet
      if it = "Clear" then get the effective backgroundColor of me
      set the backgroundcolor of tChunk to it
      select empty
   end if
   put false into scrollLock
end selectionChanged

on scrollerDidScroll hOffset, vOffset
   if scrollLock then exit scrollerDidScroll
   fwmobScroll hOffset, vOffset, mobileControlTarget()
   pass scrollerDidScroll
end scrollerDidScroll

Posts: 22
Joined: Wed Nov 21, 2018 8:27 pm

Re: "selectionChanged" handler in native scroller

Post by rcmills » Wed Jun 12, 2019 10:32 pm

So, I have with further testing, found that the selectionChanged message is only sometimes captured in a field which does not contain enough text to need scrolling. It is very capricious! It changes from testing to testing, with no code change at all!

Is this a LC bug??

Post Reply

Return to “iOS Deployment”