newSwitch moving in x-direction in the scroll view

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 )

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. 

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.

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

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

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

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

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

“updated widget lib” is in the notes???

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…

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…

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 :slight_smile:

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

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

Great, great, great. Time to update to the latest build. :slight_smile:

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.

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

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. 

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.

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