Latest available build - scrollview

I have the same problem applying 2710, but not 2702.

still broken in .2714

.2700 works

Hi all,

This issue should be fixed in an upcoming daily build. Thanks for bringing it to our attention.

Brent

Look at 2715 or later.

Rob

I’ve been having this issue in later daily builds (2721), keep getting this message when I try to call removeSelf() on a scroll view when hiding a scene. This is the error I’m getting:

?:0: attempt to perform arithmetic on field ‘contentHeight’ (a nil value)

stack traceback:

?: in function ‘_manageRowLifeCycle’

?: in function <?:524>

?: in function <?:221>

Any help to resolve this would be greatly appreciated. 

Hi @arvid.haggqvist7,

Please post some code on how you’re setting up the object, and also show exactly how/when you’re removing it in the hide portion of the scene. For clarity, remember to surround your code with “lua” tags:

[lua] -- code [/lua]

Thanks,

Brent

Sure. The scrollView is set up inside of a “getView”-function which is called when a scene is showed and which returns the scrollView-object. This is the scene code: 

[lua]

function scene:show( event )

local sceneGroup = self.view

local phase = event.phase

if phase == “will” then

elseif phase == “did” then

local sceneGroup = self.view

editview = getView()

editview.y = 90

sceneGroup:insert(editview)

end

end

function scene:hide( event )

local sceneGroup = self.view

local phase = event.phase

if event.phase == “will” then

sceneGroup:remove(editview)

end

end

[/lua] 

And in the getView-function the scrollView is set up with the following code: 

[lua]

scrollView = widget.newScrollView

{

    top = 0,

    left = 0,

    width = display.contentWidth,

    height = display.contentHeight-100,

    hideBackground=true,

    bottomPadding=200,

    --listener=scrollListener,

    horizontalScrollDisabled=true

}

[/lua]

which is the object that’s returned. I can reproduce the issue with only the returned scrollView in the getView()-function, no objects added into it. 

Hello @arvid.haggqvist7,

I’m a bit confused. In your original post, you state that you receive an error when trying to remove the object (:remove Self ()). In your code, you’re just using : remove (), as in, removing it from the scene’s group.

What is your intention? To outright remove the object (delete it), or to place it into another group?

It seems odd that you’d just want to remove it from the scene’s group, because I don’t know what group you’d want to add it to afterward… I suppose you could just place it in the overall stage, but then it will just remain on the screen.

Best regards,

Brent

Hi Brent, 

I’ve tried both removeSelf and remove in order to remove the “editview”-object (usually a scollview). What I’m trying to achieve is to prevent previously loaded editviews from showing up in front of the one currently being loaded. Any attempts to remove the scrollView results in the aforementioned error. 

Actually, nevermind, I just realised that there was some additional code that I had forgot to comment out so the issue is most likely not with Corona. I was trying to get the height of a picker wheel that didn’t exist. What is odd is that Corona didn’t point this out until trying to delete the scrollview and not saying where in the file the error occoured. Thanks for all the help anyway!