[F/OS] - Dynamic Components Extension (for every component) 2.3.0

ID needs to be an Integer instead of a String. :slightly_smiling_face:

3 Likes

Wow, that’s realy GREAT stuff


but I have - maybe a silly - question. How to get eg a click event (or any event) from dynamic generated buttons? :flushed:?


I made the Button1 invisible, generate 5 Button, set the text of the buttons to "Button #1
#5 (works fine) and use the “click event” from button1 because i found nothing else. The label is olny for recognition, if an event has been fired - but i can click any of the 5 buttons and nothing happend.

Whats going wrong in my head???
Please help.

Greetings

4 Likes

Looks like AppyBuilder don’t have generic events commit from App Inventor. Please move your project to Kodular as AppyBuilder won’t receive updates.

4 Likes

Tremendous - works perfect!

Thank you very much :smile:

2 Likes

Oh, Ok! Makes sense. Then I sort of “translate” that integer to the real id component with the GetComponent id block. That’s where my confusion was. Thanks, it’s so easy now. I spent a lot of time creating sprites before!

5 Likes

You’re welcome! I thought Integers are more memorable, so that’s I used Integers for ID to follow the Kodular’s Dynamic Component guideline.

But I can always replace it to a String on request. :grin: (which won’t break existing projects)

4 Likes

I actually need this feature to identify my components properly since its handled through “any” events instead of specific components

1 Like

You can identify your components with GetId block. It returns the component’s id which you used in Create block by passing the component’s itself. If the component is not created with Create block, it returns -1.

GetId block -> Asks for component and returns its ID.
GetComponent block -> Asks for ID and returns the component.

Generic events return the component’s itself. So you can connect it directly to GetId block to learn which X component is clicked.

4 Likes

I am still a little confused, can you post the picture of the block?

Edit:
component_method
This?

Also I have two card components that are supposed to refer the different lists when clicked
 So i would require more than an ID as there can possibly be two of the same ID

2 Likes

No, ID can’t be duplicate. Try creating two components with same ID. It will give an error if you do that. ID is always unique. Otherwise adding an ID feature would be useless.

I added a picture to old post.

2 Likes

1 Like

You can add a 0 number to the end of id if you want to create a parent component and inner components, so you won’t need two instances of extension.

For example,
Label = 1
Button = 10 (Get Label’s id and join “0” with Text Blocks)
CardView = 100 (Get Button’s id and “0” with Text Blocks)

You can parse them again by removing the last characters.

2 Likes

Can do
 However a string option would be nice for better identification

2 Likes

Ok then, I will update the extension which allows every type of object as ID along with some improvements. :slightly_smiling_face:

1 Like


Bad arguments with getting component


Blocks view

1 Like

As you can see GetComponent expects an ID, not the component because you already have the component, replace the block with GetId block, not GetComponent.

1 Like

Oh :man_facepalming:

1 Like

Could this extension be used to create global variables that are pulled from a list or is this only for things that can be interacted with such as buttons?

1 Like

It is only for components, you should use TinyDB as storing variable values, as it can hold more than one data.

1 Like

I created 3 dynamic buttons how do I make each button do a different thing because when I use the block Any button all do the same thing

2 Likes