but the scrollbar in the Android device either doesn't work or it is too small to have fingers work it.
I have looked at the various forums and info and find no help. I did find something that worked on an android - but it uses a scrolling field, not a datagrid. Unfortunately, it fails because I don't have a clickline, listbehavior, autoHilite, or scroll - so I don't know how to begin to adjust the code for a datagrid.
It seems that someone else in this world has used a datagrid on an Android and has wanted to scroll down. But I have no idea where to go.
The code that works on an Android - but uses a scrolling field goes like this
Code: Select all
/* version .9, Bernd Niggemann Nov 2010*/
local sTrack = false
local sStart
local sOldY
local sNewY = 0
local sCumulY = 0
local sClickLine
local sMomentum, sDecay, sIncScroll
local sOldScroll
local sFirstMove, sEasing = false
on mouseDown
if sEasing then
put true into sTrack
put false into sEasing
put item 2 of the clickLoc into sOldY
exit mouseDown
end if
lock screen
set the textColor of char 1 to -1 of me to black
put the clickLine into sClickLine
set the listbehavior of me to false
set the autoHilite of me to false
put the scroll of me into sOldScroll
unlock screen
put 0 into sNewY
put 0 into sCumulY
put item 2 of the clickLoc into sOldY
-- the time it takes to easeOut
put 1700 into sDecay
-- to scip the first mouseMove
-- to avoid unwanted movement of field
put true into sFirstMove
put true into sTrack
end mouseDown
on mouseMove x, y
if sTrack then
-- this avoids a movement by
-- some pixel when selecting
-- a line
if sFirstMove then
put false into sFirstMove
exit mouseMove
end if
put y - sOldY into sNewY
add abs(sNewY) to sCumulY
put sOldScroll - sNewY into tNewScroll
set the scroll of me to tNewScroll
put y into sOldY
put tNewScroll into sOldScroll
put abs(sNewY) into sMomentum
end if
end mouseMove
on easeOut
-- sMomentum holds the absolute value of last Y difference
-- low Y / momentum is probably searching -> exit
if sMomentum < 4 then exit easeOut
put true into sEasing
put the milliseconds into sStart
-- max of stepincrease = sIncScroll is currently 17 pixel, change here
put min (abs (sMomentum),17) into sIncScroll
put sIncScroll into tIncrement
if sNewY < 0 then put 0 - sIncScroll into sIncScroll
put sIncScroll into tIncrement
repeat until (the milliseconds - sStart > sDecay) or sTrack or (not sEasing)
put sOldScroll into tMyScroll
set the scroll of me to tMyScroll - tIncrement
put tMyScroll - tIncrement into sOldScroll
-- wait to let the engine breathe and
-- to track changes of sTrack
wait 2 milliseconds with messages
-- a variation of Scott Rossi's/Richard Herz's algorithm
put 1 - (min (((the millisecs - sStart)/sDecay),1)^2) into phi
put round(sIncScroll* phi) into tIncrement
end repeat
put false into sEasing
end easeOut
on mouseUp
put false into sTrack
-- sCumulY holds Sum of Ys of mouseMove
-- a high value is indicative of longer scrolling
-- low value = more likely a click/selection
if sCumulY < 6 then
if sClickLine <> "" then
put false into sTrack
put line word 2 of sClickLine of me into tTargetLine
-- traps for single letter on selected line, in that case exit
-- if you single letter to be selectable block the following line
if length (tTargetLine) < 2 then exit mouseUp
lock screen
set the listBehavior of me to true
set the hilitedLine of me to word 2 of sClickLine
set the textColor of sClickLine to white
unlock screen
-- the message that is sent when selecting a line
put line word 2 of sClickLine of me into tSelectedText
slf_SelectionMade sClickLine, tSelectedText
end if
else
easeOut
end if
end mouseUp
on mouseRelease
mouseUp
end mouseRelease