Code: Select all
on preOpenCard
if the environment is "mobile" then
set the top of grp "ContentGroup" to the top of grp "scrollingGroup"
set the vScroll of grp "scrollingGroup" to 0
set the layerMode of grp "contentGroup" to "dynamic"
createTheScroller
end if
## Get the data from dialogData
put the dialogData into tData
split tData with cr and colon
put tData["ug_ID"] into tID
put tData["ug_name"] into tName
set the title of widget "Header Bar" of this card to tName
pass preOpenCard
end preOpenCard
Code: Select all
on openCard
//put empty into field "guideDescription"
## Find the steps and stepsimg tables and gather all the info for the userGuide ID passed
put "steps_ugID = :1" into theParamsA["conditions"]
put tID into theParamsA["condition bindings"][1]
put "steps_ID ASC" into theParamsA["order by"]
sqlrecord_find "steps", theParamsA, sStepsA
if sStepsA is not empty then
put sStepsA[1] into sOriginalRecordA
end if
put sOriginalRecordA["steps_name"] into tDescription
put cr after tDescription
put sOriginalRecordA["steps_description"] after tDescription
//set the text of field "guideDescription" to tDescription
## Create an input field to show the Title
if the environment is "mobile" then
mobileControlCreate "input", "ugHeader"
mobileControlSet "ugHeader", "rect", the rect of graphic "ugHeader"
mobileControlSet "ugHeader", "visible", true
mobileControlSet "ugHeader", "fontSize", "14"
mobileControlSet "ugHeader", "textColor", "blue"
mobileControlSet "ugHeader", "textAlign", "center"
mobileControlSet "ugHeader", "enabled", false
mobileControlSet "ugHeader", "text", tName
## Create a multiLine field to show the description
mobileControlCreate "multiline", "ugDescription"
mobileControlSet "ugDescription", "rect", the rect of graphic "grScrollingGroup"
mobileControlSet "ugDescription", "visible", true
mobileControlSet "ugDescription", "fontSize", "14"
mobileControlSet "ugDescription", "textColor", "blue"
mobileControlSet "ugDescription", "textAlign", "left"
mobileControlSet "ugDescription", "enabled", false
mobileControlSet "ugDescription", "editable", "false"
mobileControlSet "ugDescription", "dataDetectorTypes", "link"
mobileControlSet "ugDescription", "autoCorrectionType", "no"
mobileControlSet "ugDescription", "scrollingEnabled", "true"
mobileControlSet "ugDescription", "opaque", "false"
mobileControlSet "ugDescription", "text", tDescription
end if
end openCard
Code: Select all
command createTheScroller
local sTopScrollerID, theWidth,theHeight,tDgRect
if environment() is not "mobile" then exit to top
if "theScroller_1" is not among the lines of mobileControls() then
MobileControlCreate "scroller", "theScroller_1"
put the result into sTopScrollerID
end if
set the unboundedHScroll of grp "scrollingGroup" to false
set the unboundedVScroll of grp "scrollingGroup" to true
put the rect of grp "scrollingGroup" into tDgRect
put the FormattedWidth of grp "ContentGroup" into theWidth
put the FormattedHeight of grp "ContentGroup" into theHeight
mobileControlSet sTopScrollerID, "hscroll", 0
mobileControlSet sTopScrollerID, "vscroll", 0
mobileControlSet sTopScrollerID, "rect", tDgRect
mobileControlSet sTopScrollerID, "contentRect", (0,0,theWidth,theHeight)
mobileControlSet sTopScrollerID, "visible", "true"
mobileControlSet sTopScrollerID, "canBounce", "true"
mobileControlSet sTopScrollerID, "pagingEnabled", "false"
mobileControlSet sTopScrollerID, "canScrollToTop", "true"
mobileControlSet sTopScrollerID, "delayTouches", "true"
mobileControlSet sTopScrollerID, "canCancelTouches", "false"
mobileControlSet sTopScrollerID, "declerationRate", "normal"
mobileControlSet sTopScrollerID, "lockDirection", "true"
mobileControlSet sTopScrollerID, "scrollingEnabled", "true"
mobileControlSet sTopScrollerID, "hIndicator", "false"
mobileControlSet sTopScrollerID, "vIndicator", "false"
end createTheScroller
on scrollerDidScroll OffsetX, OffsetY
set the hScroll of grp "scrollingGroup" to OffsetX
set the vScroll of grp "scrollingGroup" to OffsetY
end scrollerDidScroll