what is notAlreadyHandled parameter in any component mean?

360 views
Skip to first unread message
Assigned to ewpa...@gmail.com by steve....@gmail.com

Alice

unread,
Dec 19, 2019, 7:41:11 AM12/19/19
to mitappinv...@googlegroups.com
what is notAlreadyHandled parameter in any component mean?
is there any example? how it works?please~~~

截圖 2019-12-19 下午8.38.50.png


SteveJG

unread,
Dec 19, 2019, 4:32:09 PM12/19/19
to MIT App Inventor Forum
Here is what MIT says Alice  http://appinventor.mit.edu/papers/s18-patton.pdf

notAlreadyHandled is a flag to control the application of generic vs. specific handlers for a component.  What does that mean?   Perhaps MIT will elaborate and provide a simple explanation.

Regards,
Steve

ABG

unread,
Dec 19, 2019, 4:55:14 PM12/19/19
to MIT App Inventor Forum

ABG

unread,
Dec 19, 2019, 5:02:29 PM12/19/19
to MIT App Inventor Forum

Evan Patton

unread,
Dec 20, 2019, 9:44:15 AM12/20/19
to MIT App Inventor Forum
Hi Alice,

When you have a mix of specific (e.g., when Button1.Click) and generic (e.g., when any Button.Click) handlers, we first run the handler for the specific component and then the handler for any component. The notAlreadyHandled is true if there wasn't already an event block for the specific component. If there was a specific event handler that already handled the event, then notAlreadyHandled is false. This allows you to mix specific and generic event handlers and decide in the generic event handler whether you want to apply behavior or not.

More details on the any component blocks and the algorithm to determine notAlreadyHandled here.

Regards,
Evan

TimAI2

unread,
Dec 20, 2019, 10:33:01 AM12/20/19
to MIT App Inventor Forum
@ Evan

Would be good if there was an example which included the notAlreadyHandled blocks in that very useful page ;)

ABG

unread,
Dec 20, 2019, 11:16:41 AM12/20/19
to MIT App Inventor Forum
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages