Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

newSwitch moving in x-direction in the scroll view
Started by andershjarnaa Jan 25 2014 09:13 AM

- - - - -
16 replies to this topic
newswitch newscrollview bug

Best Answer andershjarnaa , 30 January 2014 - 09:34 AM

I have also tested this and it's totally steady now. Great work.

[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

andershjarnaa

[GLOBAL: userInfoPane.html]
andershjarnaa
  • Enthusiast

  • 34 posts
  • Corona SDK

I have a strange problem. When I use the widget.newSwitch inside a widget.newScrollView
the switch move in the x-axis dependent on the switch state.
 
Two switches with the same x-coordinates but different initialSwitchState (false,
true) will have different x-positions in the scroll view. Strange??
 
Am I doing something wrong, or is this a bug?
I filed a bug report some days ago, but haven’t heard back from Corona yet.
 
Do you get
the same result? See my attached code example.

 
The problem is most noticeable when you set the widget theme to “widget_theme_ios" –
on the PC simulator it will show the iOS 6 styled switch.
But even if you use the iOS7 styled switch (just remove the setTheme line), the switches
will move a bit.
 
I’m using the latest public build with graphics 2.0, but I think the problem was there in
Graphics 1.0 too.

 

local widget = require( "widget" )
widget.setTheme("widget_theme_ios")

local _w2 = display.contentWidth / 2
local _h2 = display.contentHeight / 2
local _w = display.contentWidth
local _h = display.contentHeight

local scrollView = widget.newScrollView{
		x = _w2, y = _h2,
		width = _w, height = _h+100,
		backgroundColor = { 1 },
		hideBackground = false,
		scrollBarColor = { 0 }
	}
	scrollView.isHitTestMasked = true

local mySwitch1 = widget.newSwitch
	{
	   x = 50,
	   y = 150,
	   id = "mySwitch1",
	   initialSwitchState = false,
	   onPress = onButtonEvent
	}
scrollView:insert( mySwitch1 )

local mySwitch2 = widget.newSwitch
	{
	   x = 50,
	   y = 250,
	   id = "mySwitch2",
	   initialSwitchState = true,
	   onPress = onButtonEvent
	}
scrollView:insert( mySwitch2 )

 



[TOPIC: post.html]
#2

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Known and reported bug in the widget. You're not doing anything wrong. I call it the wiggling switch bug. Hopefully it'll be fixed soon. Meanwhile the checkbox mode is not doing this so if you can get away with using a checkbox to denote on/off states then use it while waiting for the fix from CL. 



[TOPIC: post.html]
#3

andershjarnaa

[GLOBAL: userInfoPane.html]
andershjarnaa
  • Enthusiast

  • 34 posts
  • Corona SDK

Thanks ksan, great to know that it’s not me doing something wrong.
I'll try to work around the issue, and cross my fingers that Corona Labs will fix this bug soon.
 
Corona - any news on when this will be fixed?
Switches can be very useful in a scroll view, if you have a settings page with a lot of on/off settings - as I have 
 
Thanks in advance.


[TOPIC: post.html]
#4

atanas

[GLOBAL: userInfoPane.html]
atanas
  • Contributor

  • 225 posts
  • Corona SDK

Just for information - those are two separate bugs - one for the ios7 theme, and a different one for all other themes.

[TOPIC: post.html]
#5

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Hah hah. With so many of them going round and round it's hard to keep track. :-) Thanks for keeping me honest.

[TOPIC: post.html]
#6

atanas

[GLOBAL: userInfoPane.html]
atanas
  • Contributor

  • 225 posts
  • Corona SDK

No big deal, one or two - I am really happy we got a new screen management library

[TOPIC: post.html]
#7

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Yup. Nevermind the creaky furniture and dangerous appliances. New curtains was all that we needed. 



[TOPIC: post.html]
#8

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

2159 still wiggles on... Seems like this one didn't make the cut. On/Off buttons are still unusable. 



[TOPIC: post.html]
#9

atanas

[GLOBAL: userInfoPane.html]
atanas
  • Contributor

  • 225 posts
  • Corona SDK

"updated widget lib" is in the notes????



[TOPIC: post.html]
#10

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Yes. Thats what I mean. The Notes imply that something in the "widget lib" was "updated". Not sure what was "updated" but surely this was not one of those things. This feels like trying to ride a bicycle with your eyes blind-folded...



[TOPIC: post.html]
#11

andershjarnaa

[GLOBAL: userInfoPane.html]
andershjarnaa
  • Enthusiast

  • 34 posts
  • Corona SDK

We will just have to be patient with CL. I will go ahead and release my game with the bug. My target audience is iOS, and most users are running iOS7. The bug is still there, but not as noticeable as in iOS6. I have made an ugly hack in my code, to detect the width of the switch, and based on this I'll move the switch some pixel in the x-direction, so its visible even in iOS 6. But the switch will still move left/right on scroll, so I'm not glad to release the game with this bug, but have to...



[TOPIC: post.html]
#12

atanas

[GLOBAL: userInfoPane.html]
atanas
  • Contributor

  • 225 posts
  • Corona SDK

i wouldn't release an app with such a blatant issue, besides it can get rejected if Apple notices it. 

 

However I wish you good luck and some "sleepy" reviewers :)



[TOPIC: post.html]
#13

andershjarnaa

[GLOBAL: userInfoPane.html]
andershjarnaa
  • Enthusiast

  • 34 posts
  • Corona SDK

I just got a message that this should have been fixed in the latest build. I havet testet it yet thou.

 

Hi there,

 

Just letting you know that this has been fixed in 2013.2159.

 

Thanks for reporting this, and a great day,

Alex



[TOPIC: post.html]
#14

atanas

[GLOBAL: userInfoPane.html]
atanas
  • Contributor

  • 225 posts
  • Corona SDK

It is fixed indeed, I just tested it with a theme that is not iOS7. Time for a party, drinks on me :)



[TOPIC: post.html]
#15

andershjarnaa

[GLOBAL: userInfoPane.html]
andershjarnaa
  • Enthusiast

  • 34 posts
  • Corona SDK

Great, great, great. Time to update to the latest build. :-)



[TOPIC: post.html]
#16

ksan

[GLOBAL: userInfoPane.html]
ksan
  • Corona Geek

  • 2,795 posts
  • Corona SDK

Can confirm the switch is solid as a rock now. No more wiggling. I had a code mixup earlier this morning and thought it was still moving. Thanks Alex. Great work.



[TOPIC: post.html]
#17

andershjarnaa

[GLOBAL: userInfoPane.html]
andershjarnaa
  • Enthusiast

  • 34 posts
  • Corona SDK

  Best Answer

I have also tested this and it's totally steady now. Great work.




[topic_controls]
[/topic_controls]