Antwort auf: Problem mit mobile Scroller

Startseite Foren Deutsches LiveCode-Forum Problem mit mobile Scroller Antwort auf: Problem mit mobile Scroller

#8478
wfr
Teilnehmer

    Habe den Code umgebaut, aber hat nichts geändert.

    Stack2, card b1:

    on preOpenCard
       local sScrollerID
       local tScrollerRect, tContentRect
       // Only create a scroller on a mobile device
       if environment() is not "mobile" then exit preOpenCard
       put the rect of group "scrollArea" into tScrollerRect
       put 0,0,(the formattedWidth of group "scrollArea"),(the formattedHeight of group "scrollArea") into tContentRect
       // Create the scroller control
       mobileControlCreate "scroller", "my_scroller1"
       put the result into ssScrollerID
       // Set the properties of the scroller
       mobileControlSet "my_scroller1", "rect", tScrollerRect
       mobileControlSet "my_scroller1", "contentRect", tContentRect
       mobileControlSet "my_scroller1", "visible", true
       mobileControlSet "my_scroller1", "scrollingEnabled", true
       mobileControlSet "my_scroller1", "vIndicator", true
       mobileControlSet "my_scroller1", "vscroll", 0   
    end preOpenCard
    
    on closeCard
       // Delete the scroller
       global sScrollerID
    if environment() is not "mobile" then exit closeCard
    mobileControlDelete sScrollerID
    end closeCard

    Stack2:

    on scrollerDidScroll hOffset, vOffset
       // When the user scrolls move the displayed content
       set the vScroll of group "scrollArea" to vOffset
    end scrollerDidScroll

    Stack3, card c1:

    on preOpenCard
       local sScrollerID
       local tScrollerRect, tContentRect, vOffset
       // Only create a scroller on a mobile device
       if environment() is not "mobile" then exit preOpenCard
       put the rect of group "scrollArea" into tScrollerRect
       put 0,0,(the formattedWidth of group "scrollArea"),(the formattedHeight of group "scrollArea") into tContentRect
       // Create the scroller control
       mobileControlCreate "scroller", "myscroller_2"
       put the result into ssScrollerID
       // Set the properties of the scroller
       mobileControlSet "myscroller_2", "rect", tScrollerRect
       mobileControlSet "myscroller_2", "contentRect", tContentRect
       mobileControlSet "myscroller_2", "visible", true
       mobileControlSet "myscroller_2", "scrollingEnabled", true
       mobileControlSet "myscroller_2", "vIndicator", true
       mobileControlSet "myscroller_2", "vscroll", 0   
    end preOpenCard
    
    on closeCard
       // Delete the scroller
       global sScrollerID
       if environment() is not "mobile" then exit closeCard
       mobileControlDelete sScrollerID
    end closeCard

    Stack3:

    on scrollerDidScroll hOffset, vOffset
       // When the user scrolls move the displayed content
       set the vScroll of group "scrollArea" to vOffset
    end scrollerDidScroll

    Ich beschreibe nochmals das Szenario:
    – ich starte das Programm
    – ich springe von stack1 auf stack2 —> scroller funktioniert!
    – ich springe zurück zu stack1
    – ich springe von stack1 auf stack3 —> scroller funktioniert!
    – ich springe zurück zu stack1
    – ich springe von stack1 auf stack2 —-> scroller funktioniert nicht mehr!

    echt mysteriös….