newSwitch -> checkBox: will not toggle

On my report screen, I have a newSwitch->checkBox that signals if the User wants a Summary report if the checkbox is checked;if not checked, they get the detailed report.

Checking and unchecking generates the relevant reports.

The prob is that if I check the Summary object [and get the Summary report], I cannot immediately un-check the object and, thereby, get the detailed report. If I go to a radio-button group on the same screen and “switch” something there, then I can un-check the Summary box.

is this inability to toggle the checkbox object a known problem - or am I overlooking something that needs to be added to allow constant toggling?

Thanks.

Seth J Hersh

Hi Seth,

I guess we’d need to some code to better understand. You should be able to set the state of the switch programmatically via this function:

https://docs.coronalabs.com/api/type/SwitchWidget/setState.html

Perhaps that will do what you need to accomplish.

Brent

Brent - thanks for your input. I use object:setState() frequently to assign/reset on/off issues when moving among screens. this was an issue with the User touching/tapping the object - and it “refusing” to become un-checked.

but your gentle reminder to “need to see some code” led to the solution. In my onSwitchPress() code, I was programmatically switching the state back [via setState() … duhhhhhmmmb]. 

I cleaned/re-arranged the code - and now all is right with the world. My mistake - and sorry to have mislead you.

Seth

Hi Seth,

I guess we’d need to some code to better understand. You should be able to set the state of the switch programmatically via this function:

https://docs.coronalabs.com/api/type/SwitchWidget/setState.html

Perhaps that will do what you need to accomplish.

Brent

Brent - thanks for your input. I use object:setState() frequently to assign/reset on/off issues when moving among screens. this was an issue with the User touching/tapping the object - and it “refusing” to become un-checked.

but your gentle reminder to “need to see some code” led to the solution. In my onSwitchPress() code, I was programmatically switching the state back [via setState() … duhhhhhmmmb]. 

I cleaned/re-arranged the code - and now all is right with the world. My mistake - and sorry to have mislead you.

Seth