cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
jc4d
Expert

Add buttons dynamically

Hello,

 

I would like to add a button depending on the amount that is selected from the list of values.

For example, in Parameters I have: 

VALUES "Shelf_Amount", 1, 2, 3, 4, 5, 6, 7

If I select 1 from the list, one buttom will be added, if I select 2, then two buttons will be added and so on. The idea behind this is that each button will control something different, like using a different gosub depending on which button is pushed.

 

I have managed to add a simple button on the UI, but not sure how to do it in a dynamically way and with a incremental name per button. I thought that adding the variable name + 1 would do the trick, but did failed.

 

Master:

Button_Name = "Test"

 

Interface:

UI_BUTTON UI_FUNCTION, Button_Name, 0, 0, 150, 50

 

Juan.

16 Replies 16
jc4d
Expert

Thank you, yes I have an array in a condition if all the shelves are the same, but there is another condition where the shelves can be different, user's choice.

My script works flawless, just not sure if there is a more optimal way on doing it when all the shelves are different.

A_ Smith
Expert

not sure if that is what you were looking for...

 

https://drive.google.com/file/d/1N8-0rHlxeE7StJ23wwTwROxMKqIzpGhW/view?usp=drivesdk

AC 22, 24 | Win 10

Here is a quick video of where i took my shelving object

 

jc4d
Expert

Yes, exactly what I'm looking after. 👍

Thank you.

 

jc4d
Expert

You are using the same hotspot to perform different tasks depending on the direction to where you move it?.

That is fantastic, didn't know that.

I'll post a link in a bit so you can look at it if you are interested.

jc4d
Expert

Absolutely, very interested on your method.

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!