Cannot find the When block

Hi,
I have not used App inventor for quite a while. I wanted to modify an old project but I cannot find the "When" block which is in other projects and examples. I would have assumed it was in the Control section but it isn't.
Has it been replaced?

Regards,
Bob

There are many "when" blocks, which one is it that you cannot find ?

image

Hi,
The problem is I can't find any of them. I assume that from the colour of the one in the example I have (and yours above) that they would be in the Built in / Controls section.
I had hoped there would be one to "do" when a value in a lblMessage equaled a value.

Regards,
Bob

Hi,
I have found them now, I was looking in totally the wrong place.

Regards,
Bob

Hello Bob

The 'When' Blocks are for static App Inventor events like 'When Button Clicked'.

If you want to trigger an event when a value in a Label equals another value, that could be tricky because potentially your App would need to check and test constantly. If on the other hand it was something input by the User into a Text Box, you could have a 'submit' button and then compare the values.

Hi Chris,
I am using If/Then for the comparison, it is working as I require but I need to look at nesting the If/Then statements now.
Thanks to Tim? and yourself for the help.

Bob

Make sure you prevent the User from changing the input while you are running your comparison - that's why a submit button is handy. In the button event you can firstly disable the Text Box and then perform the comparison.

If /Then - that suggests there are a number of actions that can be performed, depending on which number matches which. If that is so, instead of the User inputting a value, display a List of valid values to select from. That List can be populated from a Block List, ensuring the range of values are identical, and the Block List values can be compared to the selected value via a For Loop, better than a bunch of if-thens.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.