Radio buttons widget not every responsive

I ran it on my iPhone 5 and it seemed to work as expected.  I don’t have an iPhone 4 to test on, but this widget really doesn’t do any heavy lifting that would tax the CPU or GPU.

Are there possibly other things going on in your app that could be impacting it?  Here is the sample code I used to test your button (I had to hack in the myData structure:

local widget = require("widget") local myData = {} myData.leftX = 10     local function radioSwitchListener( event )     -- Update the status box text     --print tostring( event.target.isOn )     if event.target.isOn then     if event.target.id == "Home" then     betID = homeTeamID     betOdds = teamAWinOdds     elseif event.target.id == "Away" then     betID = awayTeamID     betOdds = teamBWinOdds     elseif event.target.id == "Draw" then     betID = 99 --Draw     betOdds = drawOdds     end     end         return true     end local radioButtonOne = widget.newSwitch {    left = myData.leftX + 130,    top = display.contentCenterY - 230,    style = "radio",    id = "Home",    initialSwitchState = true,    onPress = radioSwitchListener, }   local radioButtonTwo = widget.newSwitch {    left = myData.leftX + 130,    top = display.contentCenterY - 160,    style = "radio",    id = "Away",    initialSwitchState = false,    onPress = radioSwitchListener, }   local radioButtonThree = widget.newSwitch {    left = myData.leftX + 130,    top = display.contentCenterY - 90,    style = "radio",    id = "Draw",    initialSwitchState = false,    onPress = radioSwitchListener, }

Perhaps if you try to run just that in a main.lua by itself and see how it behaves.

Rob

Weird thing, met with the client today who am developing this app for and put it on his iPhone 5 (not sure if it was a S) and the Radio buttons ran perfectly.

But on my iPhone 4s they are still very unresponsive.

Dave

I’m seeing the radio buttons sometimes getting stuck and I cannot select another. This is happening on the simulator. Starter v2014.2189 It seems to occur randomly, but I’m not sure if it’s my code at this point. After a few seconds, it sometimes becomes unstuck and I’m able to make a selection. Strange.

Hi @bvsmailuser,

Did you follow the proper setup for these, grouping “related” radio buttons by putting them in distinct display groups, using the correct listeners, etc.?

Brent

I believe so, they are grouped so only one button is selected at a time. I’m not using a listener yet, could that be why? The values are being set based on what I read from the sqlite database. I can’t always change the values in a group, sometimes they seem to get stuck on one., other times they seem to work as intended. Thanks for your interest!

For me, the buttons only become sticky or stuck if I do a setState operation on them earlier. Otherwise, they never get sticky or stuck.

And yes, all 3 are placed in a group. Am I doing something wrong here?

highRB:setState( {isOn=false}) mediumRB:setState( {isOn=true}) lowRB:setState( {isOn = false})

This seems correct at a glance. But, if the buttons are grouped, then you shouldn’t need to “setState()” on all of them… instead, just turn “on” the one you want, and the others should switch off. If this isn’t happening, it may be a bug or something that was resolved in a daily build since the version you’re using.

Best regards,

Brent

Brent,

Thanks for your response!

Removing the setState() function call to turn off the other two buttons has resolved the sticky and stuck problems.

However, I’m now seeing two buttons on at the same time occasionally even though they share a group.

I hope it works correctly on the daily build! I will have to wait for the next public release to test this of course.

Last week I encountered a rendering problem with Tableview delete. I’m told it was fixed in the daily build. 

BVS

Now I’m getting a bit nervous about the stability of widgets. I’m using the latest public build.

Hi BVS,

Can you post your code here so I can test in a recent daily build?

Thanks Brent, Let me write a very small sample and send it to you… BVS

Hi Brent,

Here is the sample code. If you want the entire test app I can give that to you.

I think there is a problem with grouping on the radio buttons.

5376db4d894c5.jpgImage of error

        local buttonGroup = display.newGroup()         local pHighRB = widget.newSwitch {            left = 50,            top = 300,             style = "radio",            id = "High",            initialSwitchState = true         }         buttonGroup:insert(pHighRB)         local pMedRB = widget.newSwitch {            left = 100,            top = 300,             style = "radio",            id = "Med",         }         buttonGroup:insert(pMedRB)         local pLowRB = widget.newSwitch {            left = 150,            top = 300,             style = "radio",            id = "low",         }         buttonGroup:insert(pLowRB)         pMedRB:setState( {isOn=true})         -- try uncommenting the line below, this will cause all 3 buttons to turn on         --pLowRB:setState( {isOn=true}) -- all objects must be added to group (e.g. self.view) sceneGroup:insert( bg ) sceneGroup:insert( title ) sceneGroup:insert(buttonGroup)

Thanks,

BVS

This is an already filed bug #29138 and will be fixed in a daily build in the near future.  These fixes should make it into the next public build, but I don’t have an ETA on that.

Rob

Thanks for getting back to me Rob. I’m disappointed to hear that it’s not fixed yet. These are basic radio button functions. I’m starting to lose my confidence in Corona widgets. I hope I didn’t waste my time.

The forums say you are a starter account.  This will be fixed in the next public build.  Now for the Pro and Enterprise subscribers, they will get the fix the next time the widget library gets updated, which should be pretty soon.

That’s encouraging at least. I can afford to buy Basic but it sounds like I will have to wait just as long as the public build.
I’m also waiting on a tableview render problem on row delete. Was told this was fixed on a daily build.
This is a shame because my app is 90% complete and now I have to reconsider my options.