Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Scrollview behavior on Graphics 2.0
Started by kbradford Nov 20 2013 12:03 PM

23 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 231 posts
  • Corona SDK

Migrating to graphics 2.0 on one of my current apps and getting 2 really weird scrollview problems.  Note that I am using graphics compatibility mode.

 

Problem 1:  

 

When the scrollView is created and loaded with content, it doesn't also start at the top of the scrollView.  For example, I created a scrollView, add a bunch of content, and now it's first appearing about 1/3 of the way scrolled down.  If I drag up a bit it will then snap to the correct place at the top.  Also of note is if I do a scrollTo("top", 0) then it actually scrolls all the content to the middle of the screen not the top, and another drag of the scrollview will fix it and spring to the correct location.  Here's the code I use to create the scrollView. 

 

	scrollView = widget.newScrollView
	{
		left = 0,
		top = titleText.y+titleText.height/2,
		width = screenWidth,
		height = screenHeight,
		id = "onBottom",
		friction = .942, --.962,
		horizontalScrollingDisabled = true,
		verticalScrollingDisabled = false,
		hideBackground = true,
		hideScrollBar = true,
		topPadding = 0,		
		bottomPadding = 0,
		listener = scrollListener,
	}	
	scrollView._view._isHorizontalScrollingDisabled = true	
	scrollView:setReferencePoint( display.TopCenterReferencePoint )	
	scrollView.x = screenMiddleX
	scrollView.y = titleText.y+titleText.height/2	
	group:insert(scrollView)	

 

Problem 2:

The second problem is that there is always a bunch of space at the end of a scrollView, even with bottomPadding = 0.  There is usually a half a screen (240ish pixels) of empty space no matter what I make the height of my scrollView.  I have a few things I want to anchor to the end of the scrollView, but no matter what I do it always scrolls past whenever I put this anchors.

 

Any ideas?  Haven't reported them as bugs yet because it could just be me not fully understanding some of the Graphics 2.0 changes.



[TOPIC: post.html]
#2

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Alumni

  • 253 posts
  • Corona SDK

Hi kbradford,

 

What are you inserting in the scrollView, and at which coordinates? The scrollview in v1 compatibility mode should behave exactly like the Graphics1 one did...

 

alex



[TOPIC: post.html]
#3

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 231 posts
  • Corona SDK

Inserting a variety of graphics and text, and use a y value to keep incrementing where to place it further down the scrollview.  For example:

 

local currY = 0
for i=1,20 do
	local text = display.newText("Some text", 0, 0, screenWidth, 0, fonts["Museo"], 14)
	text:setReferencePoint( display.CenterLeftReferencePoint )	
	text:setTextColor(25, 180, 146)					
	text.x = screenLeft+22
	text.y = currY+text.height/2
	scrollView:insert( text )
	
	currY = currY + 50
end


[TOPIC: post.html]
#4

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

I tried to use compatibility mode (graphicsCompatibility = 1) with build #2085

 

scrollView behaves different for me also.

 

The problem is exactly like kbradford said above

 

(1) there is an extra space on the top and if I scroll down, it backs to normal (the space is gone)

 

(2) there is a huge space at the bottom

 

If it is changed to iPad simulator/device, the first problem is gone but there is another problem that there is an extra space on the left.



[TOPIC: post.html]
#5

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Alumni

  • 253 posts
  • Corona SDK

Ok, seems like a bug. Could you please post one and paste the number back on the thread?

 

Thanks,

Alex.



[TOPIC: post.html]
#6

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 231 posts
  • Corona SDK

Submitted as a bug, Case 28253.  Thanks!



[TOPIC: post.html]
#7

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Alumni

  • 253 posts
  • Corona SDK

The case is incomplete, unfortunately. Please submit a case that runs, and includes a config.lua. Your submitted file contains variables you define previously, please remove them or paste in the code that instantiates their values.

 

Thanks in advance,

Alex



[TOPIC: post.html]
#8

kbradford

[GLOBAL: userInfoPane.html]
kbradford
  • Contributor

  • 231 posts
  • Corona SDK

Done, case 28255



[TOPIC: post.html]
#9

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Alumni

  • 253 posts
  • Corona SDK

Thank you.

 

Alex



[TOPIC: post.html]
#10

joe528

[GLOBAL: userInfoPane.html]
joe528
  • Contributor

  • 800 posts
  • Corona SDK

By the way, this problem does not exist if migrating to 2.0 instead of using compatibility flag.



[TOPIC: post.html]
#11

alex01

[GLOBAL: userInfoPane.html]
alex01
  • Observer

  • 14 posts
  • Corona SDK

I am having the same issue here. Looking forward for a prompt fix.

Thanks!

Alex



[TOPIC: post.html]
#12

Susa

[GLOBAL: userInfoPane.html]
Susa
  • Observer

  • 7 posts
  • Corona SDK

is it solved?



[TOPIC: post.html]
#13

amundsonjd

[GLOBAL: userInfoPane.html]
amundsonjd
  • Observer

  • 4 posts
  • Corona SDK

Has this issue been fixed yet?



[TOPIC: post.html]
#14

alexf

[GLOBAL: userInfoPane.html]
alexf
  • Alumni

  • 253 posts
  • Corona SDK

Hi guys,

 

A fix is being tested atm. I'll update the thread when it gets into a daily build.

 

Thanks,

Alex



[TOPIC: post.html]
#15

Alyousef

[GLOBAL: userInfoPane.html]
Alyousef
  • Enthusiast

  • 55 posts
  • Corona SDK

Hi Devs,

 

Sorry for jumping into here. But I have a similar issue in regards to scrollview behavior. 

 

If I want to insert any display objects at the end of the scrollview (e.g, load more data or append) after the scrollview has already been created and I'm at half way at the scrollview, it span back to the top. That's really undesirable behavior! 

 

Are you aware of this issue?



[TOPIC: post.html]
#16

eja

[GLOBAL: userInfoPane.html]
eja
  • Contributor

  • 124 posts
  • Enterprise

Hi Devs,

 

Sorry for jumping into here. But I have a similar issue in regards to scrollview behavior. 

 

If I want to insert any display objects at the end of the scrollview (e.g, load more data or append) after the scrollview has already been created and I'm at half way at the scrollview, it span back to the top. That's really undesirable behavior! 

 

Are you aware of this issue?

 

hey Mustafa, a quick work around is to do the following code:

-- right before you call your function to append more data
local x,y=scrollView:getContentPosition()

-- after you have appended objects/data into the scrollview
scrollView:scrollToPosition{x=x, y=y, time=0}


[TOPIC: post.html]
#17

staytoooned

[GLOBAL: userInfoPane.html]
staytoooned
  • Contributor

  • 198 posts
  • Corona SDK

I'm having the same issues as above. My scrollView worked perfectly in the previous graphics 1.0 versions. As soon as graphics 2.0 was introduced, my scrollView stopped working. I've inserted all display objects into the scrollView as always. I even tried inserting the scrollView and display objects into a container and that made the problem far worse.

 

Can someone provide a quick example of how the scrollView works with the latest Graphics 2.0 build?

 

Has there been a fix for the problems stated above?

 

Just my two cents...Corona is a royal pain. Every time I have upgraded my code to meet the changes in the latest version, removing deprecated items, etc. (days of work) the program changes causing me to go through the same torture over and over again. This is a huge setback as I do the code and marketing. I'm left with no time to market. 



[TOPIC: post.html]
#18

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,378 posts
  • Enterprise

@Staytooned, is there a reason you didn't just add:

 

graphicsCompatibility = 1

 

in your config.lua instead of trying to convert your existing app to the new way of doing thing?



[TOPIC: post.html]
#19

dominic.wood8

[GLOBAL: userInfoPane.html]
dominic.wood8
  • Enthusiast

  • 45 posts
  • Corona SDK

HI Rob

I am updating a business App and I having exactly the same issues. I am using 2288 so a much newer build in CompatibilityMode = 1

 

If I move to compatibiltyMode = 2 will this fix this problem

 

note the work around doesn't really fix the issue, sometimes the content appears in the correct position but then scrolls down so there's 2/3 a screem of blank

 

I've tried playing around with the pad values but no luck either



[TOPIC: post.html]
#20

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,378 posts
  • Enterprise

@dominic.wood8, there isn't a compatibliyy mode = 2.  You either have a:

 

graphicsCompatibility = 1

 

line in your config.lua or you don't.  I suppose setting it to anything other than 1 would work, but the official thing is to not have the line for Graphic 2.0 builds.

 

I can't find a bug report for this.  If you can build a small sample that shows the problem (you must also include your build.settings and config.lua files in a .zip file) and file a bug report using the "Report a Bug" feature a the top of the page.

 

Thanks

Rob



[TOPIC: post.html]
#21

dominic.wood8

[GLOBAL: userInfoPane.html]
dominic.wood8
  • Enthusiast

  • 45 posts
  • Corona SDK

thanks for the reply, don't worry I've not used =2 but I wanted to know that if I went to the effort changing the app to graphics 2.0 the issues would stop.

 

As I can't build with pre v2.0 any more I'm trying to track down what is happening, I have nothing to compare it with.

 

Do you know if the coords of the  :scrollToPosition are calculated with the new coords system when compiling with the latest builds? If they are I think what is happening is that the scrollview starting coordinate is wrong causing the scroll view to 'bounce' and appear too far down.

 

Ditto does :scrollTo("top", {time = 250}) work?

 

 

Again I can't compare 'old' and 'new' scrollviews but it now has a huge amount of 'bounce' so when you scroll past the top it pings back with the content you want to see in the wrong place. So now its hard to scroll to the top of your content

 

I haven't put in a bug as I would have any issues would have been fixed by now especially as I had read the the pad was working in one of the latest daily builds.

 

Great if you could answer regarding the coords system of the :scrollTo( 



[TOPIC: post.html]
#22

dominic.wood8

[GLOBAL: userInfoPane.html]
dominic.wood8
  • Enthusiast

  • 45 posts
  • Corona SDK

Just done some more testing I can confirm the problem. When using the line a

 

scroller:scrollTo("top",{time = 250})

 

the scrollView appear to start at the top or maybe just a line or two above, this causes a crazy bounce to scroll your content so it starts 2/3 the way down the screen.

 

can you confirm the :scrollTo works on your code examples, as I have read that scrollview behaviour is now eratic.. will converting to graphics 2 fix this?



[TOPIC: post.html]
#23

rmbsoft

[GLOBAL: userInfoPane.html]
rmbsoft
  • Contributor

  • 444 posts
  • Corona SDK

I don't think this is only related to ScrollView, I have exactly the same issue with tableview, anyone else?



[TOPIC: post.html]
#24

Rob Miracle

[GLOBAL: userInfoPane.html]
Rob Miracle
  • Moderator

  • 25,378 posts
  • Enterprise

TableViews use ScrollViews. 

 

Can you file a bug report on this please. You must include a build.settings and config.lua in the zip file.

 

Thanks

Rob




[topic_controls]
[/topic_controls]