2

I am working on a livecode application for Android, iPhone, Windows. I would like to add a scroller to a group. So I set vertical scroller of group to true and it worked with a vertical scroll bar on the right nicely for Windows. But when testing it for Android there still a vertical bar for scrolling, I was assuming it may automatically work like a fundamental scroller as it comes with android.

I would like to add a touch scroller instead of a vertical scroller for Android and Iphone. How i can do that?

bnjmn
  • 4,508
  • 4
  • 37
  • 52
Rohit Bhardwaj
  • 269
  • 4
  • 20

2 Answers2

4

This lesson explains how to create a native scroller for a text field. However, this method can be implemented on any group-

http://lessons.runrev.com/s/lessons/m/4069/l/94412-creating-a-native-scroller-to-scroll-a-field

Josh Darnell
  • 11,304
  • 9
  • 38
  • 66
Neil Roger
  • 681
  • 3
  • 6
  • this is just for text field but how can i do it for whole group having various multiple control in it? – Rohit Bhardwaj Jul 22 '13 at 10:28
  • 1
    although the example is a text field, you can alter the lesson to allow you to scroll a group of any contents. Just replace the text field group with an alternative group – Neil Roger Jul 22 '13 at 11:06
1

With my apologies to the original author, for the lack of attribution, here is some script that will allow scrolling of groups on both desktop and mobile platforms, and does not use the native iOS or Android scrolling "overlays":

local allowMove

on mouseDown
   put mouseH(),mouseV() into allowMove
end mouseDown

on mouseMove X,Y
   if allowMove is not empty then
      lock screen
      if the hScrollbar of me then
         set the hScroll of me to the hScroll of me + (item 1 of allowMove-X)
      end if
      if the vScrollbar of me then
         set the vScroll of me to the vScroll of me + (item 2 of allowMove-Y)
      end if
      put X into item 1 of allowMove
      put Y into item 2 of allowMove
      unlock screen
   end if
end mouseMove

on mouseUp
  put empty into allowMove
end mouseUp

on mouseRelease
  mouseUp
end mouseRelease

The original script has been modified slightly by me to allow scrolling only if the corresponding scrollbars are visible. This makes it very quick and easy to enable or disable scrolling in different directions. I use this for prototyping.

Charles B
  • 71
  • 7
  • Hi Charles, I am trying to integrate this piece of code in my Card Script.But it is giving error on "if the hScrollbar of me then" Can you please explain how can i resolve it? – Rohit Bhardwaj Aug 26 '13 at 06:11
  • Hi Charles, great code indeed. Rohit, "if the hScrollbar of me then" is equal to write: "if true then", this property specifies whether a field (or group) has a horizontal scrollbar. – Cue Sep 27 '13 at 20:39
  • @charles-b Hi Charles, what is the original script without your modifications to allow scrolling only if the corresponding scrollbars are visible? Can you post it here please? – mark Jun 17 '14 at 03:35
  • @keram Just remove lines 4,6,7 and 9 of the mouseMove handler. – Charles B Jun 18 '14 at 03:31