How to create a dynamic button and add an if condition for each button

Hello, I want to know how to create a dynamic button and how to add an if condition automatically when click a button

1 Like

What you want to do on button press?

1 Like

You can use when any button click block u can find this in block section

I have a pre-made button1 and when I click it, it shows a notifier button to add a function. For example, if I tell on lights, it will go through an if condition to check if the function was light on or not. After checking, whenever I click it, will run a function.

But, I think this does not work for dynamic components.

just thinking does not work in logic
have u tried that
if not then how can u say that bru[

1 Like

first tell are u using dynamic component extension or kodular dynamic component

1 Like

I am using a kodular one not the extension.

I meant that it doesn’t work for the individual button inside a dynamic component made. It works for the Original component like Button1 and Button2. And I have 2 dynamic button(original) and they both have very different functions for my project.

if u are using kodular dynamic component then what is the problem

component_event

this block is available in dynamic button

I got the solution. I am saving the function in tinydb while creating a dynamic button and storing the function name as the value. When I click a button I call the function(The above image) and as the tag of the tiny db is the id, I am calling an if condition to check the value that if it is equal to ‘on the led’, It will on the led. And Thanks For Helping Me

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