The native scroller callbacks don't work for browser

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
bmatichuk
Posts: 15
Joined: Tue Oct 12, 2010 7:19 am
Location: Edmonton

The native scroller callbacks don't work for browser

Post by bmatichuk » Tue Jul 24, 2012 7:53 pm

I've added a native browser control. and all is fine.
The image loads and all is fine.
Except that the scroll callback don't work.
Is there any trick to this? Or do they just not work for the browser control?

on preOpenCard
--global mScrollerId
--iphoneControlCreate "browser"
send "makeControl" to group "Browser"
--put the result into sBrowserId
put gTempId into sBrowserId
iphoneControlSet sBrowserId, "visible", "true"
iphoneControlSet sBrowserId, "canBounce", "true"
iphoneControlSet sBrowserId, "autoFit", true
iphoneControlSet sBrowserId, "pageEnabled",true
--tpagingEnabled
iphoneControlSet sBrowserId, "rect", the rect of group "Browser"
--(the left of this card , the top of this card, the right of this card , the bottom of this card )
iphoneControlSet sBrowserId, "contentRect", (0,0,1000,1000)

loadImage
end preOpenCard

on scrollerDidScroll pOffsetX, pOffsetY
answer "yes" && pOffsetx && pOffsetY
if pOffsetX > 20 then
doAction "Retreat"
else if pOffsetX < -20 then
doAction "Advance"
end if
end scrollerDidScroll
on scrollerBeginDrag
answer "yes"
end scrollerBeginDrag


on loadImage
local localURL,imageNum
put the activeImage of card "View" into imageNum
put specialFolderPath("Documents") & "/image" &imageNum&".jpg" into localURL
replace " " with "%20" in localURL
iphoneControlSet sBrowserId, "url", "file://" & localURL
end loadImage

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: The native scroller callbacks don't work for browser

Post by Klaus » Thu Jul 26, 2012 12:29 pm

Hi bmatichuk,

yep, the iOS "Scoller" (UIScrollView) and "Browser" (UIWebView) objects are two different beasts and the syntax is obviously not exchangable.
Loooks like you cannot control the scrolling of a browser.


Best

Klaus

Post Reply

Return to “Multimedia”