[Extension Suggestion] Can anyone make an extension where there is a common block for event?

b
here the component varible gives the component
event gives the name of the event
variable list gives a list of the variable values for eg if an canvas dragged then the x,y are the variable of the event . so here the variable values are combined as a list.

can anyone make this extension

sorry pls correct my spelling variable instead of varible

Have you seen/used/tried the anyComponent blocks ?

why are you asking

Cause he is saying any component block is the solution

Because these allow you to select a component and returns its actions

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

no , i know this i want a component which is generic for all type of component . you have shown is generic for only one component

see i asked block which is generic for all the component (button label textbox spinner etc)

Essentially you are looking to have a "Debug Block"?

1 Like

@rishiraghav_vr I think it is possible because you need to make lots of changes to the current App Inventor system.

as @TIMAI2 answered you, it will be possible with anyComponent block, but you can only get from which component the event was called, the event and the component type is fixed so it means you can't listen event DatePicker's Click event using Button's Click event.

It might be possible to listen to their events through an extension.

could anyone send me the extension what i asked for?

no one has made the extension you are looking for yet, i may try it later

I'm not sure what you are requesting right now is possible with extensions. The event dispatch system works by matching on (component, event) tuples and executing the corresponding handler, if present. The generic event functionality used by the any component blocks had to be patched into the existing system and requires changes to both the Java code and the Scheme code in runtime.scm. The two parts of the system in question aren't modifiable by extensions, i.e., it will require a modification to core App Inventor to support this.

1 Like

Hi @ewpatton i am thinking this might be possible just need a way to get all components in screen . is this possible?

nb188 has the ability to list the direct children of a form, so you can enumerate all of the components by walking the tree. I don't know how this will interact with extensions that dynamically create components though.

3 Likes

umm then why asking for aix -

all the components are declared as fields in the ScreenN class that extends the form, to that there is a ModuleMethod of events that holds the ModuleBody I tried to change that, but it resulted in an infinite loop

One possibility is that you've made a loop by catching all of the events and reporting them via your new extension's event block, which will trigger your code again, ad infinitum. Your extension is observing the same system it's a part of and therefore things can get tricky.

Another approach might be to replace form$Mnenvironment with a special subclass that will return a function object that can be applied when an event name style signature is detected. Again, you'll want to make sure you aren't reporting your own extension's events otherwise you'll get stuck in an infinite loop (or stack overflow, killing the app).

4 Likes

For extension developers who are going to try to make this extension.
My suggestions -

  1. First get all components
  2. run a loop through components and use reflection to get functions which has SimpleEvent annotation
  3. Then use this method -
    Listen for event dispatches in component through the extension - #34 by ewpatton