Я пытаюсь создать собственный скроллер для Android, используя приведенный ниже код. Я сохранил стек как отдельное приложение и установил его на свой планшет Android, но текст не прокручивается.
local sScrollerID
on preOpenCard
local tScrollerRect, tContentRect
// Only create a scroller on a mobile device
if environment() is not "mobile" then exit preOpenCard
// Set the area of the scroller
put the rect of group "scrollArea" into tScrollerRect
// Set the are of the content to be scrolled
put the left of field "lorem",the top of field "lorem",the right of field "lorem",the formattedHeight of field "lorem" into tContentRect
// Create the scroller control
mobileControlCreate "scroller", "loremScroll"
put the result into 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
end preOpenCard
on closeCard
// Delete the scroller
if environment() is not "mobile" then exit closeCard
mobileControlDelete sScrollerID
end closeCard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll
Как исправить скрипт? Стек здесь для всех, кому нужно его увидеть: встроенная прокрутка android.zip
=========
Я также попытался создать такую же прокрутку для группы, состоящей из нескольких текстовых полей, и даже с предложениями Марка (см. Ниже) это все еще не работает.
код здесь:
local sScrollerID
on openCard
local tScrollerRect, tContentRect
// Only create a scroller on a mobile device
if environment() is not "mobile" then exit openCard
// Set the area of the scroller
put the rect of group "scrollArea" into tScrollerRect
// Set the area of the content to be scrolled
put the left of group "scrollArea",the top of group "scrollArea",the formattedWidth of group "scrollArea",the formattedHeight of group "scrollArea" into tContentRect
// Create the scroller control
mobileControlCreate "scroller", "loremScroll"
put the result into 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
end openCard
on closeCard
// Delete the scroller
if environment() is not "mobile" then exit closeCard
mobileControlDelete sScrollerID
end closeCard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "scrollArea" to vOffset
end scrollerDidScroll
Какие исправления мне нужно внести, чтобы групповая прокрутка работала? Стек можно скачать отсюда: нативная прокрутка в android- группа.zip
================
3) Теперь, когда прокрутка для группы работает правильно, я попытался создать такую же прокрутку для сетки данных, используя этот код:
on openCard
local tScrollerRect, tContentRect
// Only create a scroller on a mobile device
if environment() is not "mobile" then exit openCard
// Set the area of the scroller
put the rect of group "DataGrid 1" into tScrollerRect
// Set the area of the content to be scrolled
put 0,0,(the formattedWidth of group "DataGrid 1"),(the formattedHeight of group "DataGrid 1") into tContentRect
// Create the scroller control
mobileControlCreate "scroller", "loremScroll"
put the result into 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
end openCard
on closeCard
// Delete the scroller
if environment() is not "mobile" then exit closeCard
mobileControlDelete sScrollerID
end closeCard
on scrollerDidScroll hOffset, vOffset
// When the user scrolls move the displayed content
set the vScroll of group "DataGrid 1" to vOffset
end scrollerDidScroll
Но прокрутка сетки данных с этим кодом не работает. Какие исправления я должен сделать? Стек можно скачать здесь: DG-android native scroller.zip< /а>