I have a datagrid with long list of data in a stack.
A scroller is created on opencard to enable scrolling of the datagrid, and then when one of the row is clicked (mouseUp), some actions will be taken (e.g. answer something).
Script on the card:
Code: Select all
on openCard
send "scroller_create" to me in 0 sec
end openCard
on closeCard
send "scroller_delete" to me in 0 sec
end closeCard
on scroller_create
local tScrollerRect, tContentRect
set the vScroll of grp "listA" to 0
##Only create a scroller on a mobile device
if environment() is not "mobile" then exit scroller_create
##Set the area of the scroller
put the rect of group "listA" into tScrollerRect
##Set the area of the content to be scrolled
put 0,0,(the dgFormattedWidth of group "listA"),(the dgFormattedHeight of group "listA") into tContentRect
##Create the scroller control
mobileControlCreate "scroller", "listScroll"
put the result into sScrollerID
##Set the properties of the scroller
mobileControlSet "listScroll", "rect",tScrollerRect
mobileControlSet "listScroll", "contentRect",tContentRect
mobileControlSet "listScroll", "visible",true
mobileControlSet "listScroll", "scrollingEnabled",true
mobileControlSet "listScroll", "vIndicator",true
mobileControlSet "listScroll", "vscroll", 0
end scroller_create
on scroller_delete
if environment() is not "mobile" then exit scroller_delete
mobileControlDelete sScrollerID
end scroller_delete
on scrollerDidScroll hOffset, vOffset
set the DGvScroll of group "listA" to vOffset
set the DGSelectedLine of group "listA" to empty
end scrollerDidScroll
on mouseRelease
set the dgHilitedLines of group "listA" to empty
end mouseRelease
Code: Select all
on mouseUp
put the dgHilitedLines of group "listA" into theLine
put the dgDataOfLine[theLine] of group "listA" into pData
##Some functions
....
end mouseUp
I wonder if there is any control that I should take care of, so that as I am scrolling the datagrid it won't trigger mouseUp?
Thank you.