RadioButtons not working as expected - default selection error

Hello,

I'm using the "RadioButtons" extension and see a problem when I want to set a "default" choice.

I have 2 sets of RadioButtons with 3 choices in each: "Unchanged", "ON" and "OFF".

I'm using two "call RadioButtonsX" pocedures to initialize both groups of RadioButtons to "Unchanged" and this, when the screen "Relays" opens.

Unfortunately, only the RadioButtons1 group accepts to set the desired default choice. In the second group, absolutely no choice is selected (all three choices are unselected/blank).

Is this a bug (or is it me :grin:) ?

Thanks for any info :wink:

Rog'

Try changing the order ?

Create, Set
Create, Set

?

I tried couple of things, amongst them, what you suggested too.

Still, only the first RadioButton can have a default set :no_mouth:

Try adding a clock timer to set the second one...?
May only need 200ms...

I just noticed something...

My app has three screens where the second one is the one with the radio buttons.

When I open it for the first time after I launched the app, the radio button act oddly as described before.

But when I open the page for the second time (=without having closed the app), the radio button seem to work OK.

Should I use an other control than when Relays .initialize ?

Relays is a Screen? If so then yes, make a Clock Timer Block for the Radio Button settings and call that from Relays Initialize, very last of what ever else is put in Relays Initialize. Set the Clock Timer interval to around 200 millis and disable it on first run.

image

I did this. Seems to "tick" every second (I don't understand how the timer works - I'll have a look lateron).

Anyway, I get an error message "Bad arguments to > cannot accept the arguments:,,[true],[1]".

I then have no other choice than to leave the app.

No, you haven't got that right - let me make an example for you - back in 5 mins

Thanks Chris.

Yes, "Relays" is my second screen.

OK, very brief example, I'm using Screen1, you are of course using Screen Relays:

Snap7

This should work - if not, increase the milliseconds.

....and by the way, read this:
https://www.professorcad.co.uk/appinventortips#TipsGui

OK, thanks a lot.

Give me a minute to try this.

Meanwhile, do you think the problem comes from my phone or is it a kind of bug or something else?

It's not a bug. The Screen is initializing and that has to take precedence. If we put other tasks in that Block, the initialization and the other tasks may not complete - Think of them as "fighting" for the same memory (not entirely true).

So, by setting the other tasks in a Clock Timer, we give the Screen Initialization time to complete first.

Note, it is always a good idea to set Clock Timers up in the Blocks area - you can see the setting and tweak them without going back and forth to the Designer attributes palette. However, you should un-tick the values in the palette.

image

This unfortunately doesn't give a good result.

But, as said before, when I open the Relays screen for the second time ( and followings too), the radio buttons work!

Strange....

Your Blocks are incorrect! All your Radio Button set up should be in the Clock timer block.

OK, I change this now.

Like this?

...no, doesn't work like I did :slightly_frowning_face:

Yes, that's it. did you un-tick the settings in the Designer palette?

Let me search for the "Designer palette" - I don't know what this is... give me a second to find please.

image

Shall I set the intervall to 200 here?