What is "notAlreadyHandled" for in "Any" blocks?

On the occasion of this question, I will ask. What is "notAlreadyHandled" for in "Any" blocks?

The notAlreadyHandled parameter is true if
no other event block specifically handles the event for component.

More information here:

http://ai2.appinventor.mit.edu/reference/other/any-component-blocks.html

I am reading and I can say that this is the only method I do not understand. There are a few examples, but none of them use the method I am asking.

I can try to understand it like this. If in addition to any component button click there is an ordinary event in the application, e.g. button1.click, then is it true? And you can then programmatically turn off checking conditions in any component?

Perhaps the easiest way to understand it is like this:

  1. You have a button (Button1). When you click the button using its event block it sets the colour of the button to red.
  2. You also have an anybutton/anycomponent routine that sets all the buttons on the page to the colour blue.
  3. In that routine, you can test for any buttons that are already handled, in this case Button1. "notAlreadyHandled" in the case of Button1 is false, because it has a click event associated with it, you could therefore exclude Button1 (testing for notAlreadyHandled) from your iteration to change all the buttons to blue in colour.

Does that help?

4 Likes

I understand. This can be useful in my applications. Thanks.

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