[Free] CompCreator - create component dynamically

Saw the example further up in the thread about checking component type.
So I tried to get around it by:


And it logs: com.google.appinventor.components.runtime.HorizontalArrangement@4cb320
But it's unable to reference the component in any way. So the logging of the component Index fails

Hmm, tried to make a small example of the problem, but was unable to recreate, so I will check a bit more.

What is the difference between this one and the dynamic component extension?

No id is needed.

I see. I would like to create an other extension's component (Andres Cotes WebSocketCl) dynamically. Is it possible? I could not achieve it with the DC extension, neither with this one so far. I guess it only can create AI2 native components, isn't it.

Yes, and only visible components.

1 Like

As I thought. Thank you. And I guess the same apllies to @yusufcihan 's DC.

1 Like

Creating extension components dynamically should work as expected, it just doesn't work with by simply entering its name, like "Button", but passing an existing component's block is supported regardless of if it is a native component or not.

2 Likes

Brilliant. I could create it. I tried it before but i tried to create on Screen1 and that did not work. I had to create on an arrangement.
I still have a problem. When I create one at screen init that works. If i delete it and recreate in runtime it does not work. I still did not have time to debug why.

If the above is not about CompCreator, please start a new topic

:+1:
Only answered him.

v8.6 update:

  1. ListComponents function added. this can return a list of same type (like buttonts, labels) in one container.
  2. other small bugs.

Difference between this ListComponents and native every Component:

  1. List Components return a list of some container, direct children or not. Every component only can return all the same type component on the screen.
  2. ListComponents will return a list with certain order, but Every component not.
  3. Every component do not support dynamicly created one.

Could we have some example blocks for the list components function ?

To get all checkbox in the VSA, even if the checkbox is not the son of VSA, but grand grand son

compcreator-listview.aia (60.8 KB)

1 Like

First, thanks for your efforts on this amazing extension!

Now, am I doing something wrong or is this a bug? I am trying to set a textbox to be numbers only. Below is the block I am using to create the textbox. When the box is created, it does allow any character to be added and doesn't force numbers only.

Not doing some thing wrong.

replace with a text block that says "NumbersOnly"

@Kevinkun note this for next release :wink:

2 Likes

Thanks!

3 posts were split to a new topic: Yusifchan Dynamic Components Extension: Attempt to invoke virtual method 'int org.json.JSONArray.length()' on a null object reference

this works with any android version?. the compcreator?

I have used it on Android 7 to 13 without a problem. If you have earlier/later devices, I suggest you test the extension on those devices and report back.

It would be much better if you did this in advance of asking a question so you could then ask:

I tried this extension on Android "X" and it didn't work for me, here are my blocks:

1 Like