10-08-2018 09:23 AM
Hello, I have the code attached. And I want it to work as follows, without placing another event.
1 - When pressing button "A", write 1 in the indicators. (Done)
2 - Press "B" to make the "Alt1 button" and "Alt2 button" buttons visible. (Done)
3 - Clicking "Alt1 button" type the Knob control in Alt 1. And when you click "Alt2 button" type the Knob control in Alt 2. (Can not)
How can I do this?
Thank you.
10-08-2018 09:45 AM - edited 10-08-2018 09:59 AM
@Pão wrote:
2 - Press "B" to make the "Alt1 button" and "Alt2 button" buttons visible. (Done)
Really not done. Buttons hide immediately after make visible
you can use local variable or shift registers
And you need make action for alt 2 similar with alt 1
10-08-2018 09:49 AM
First, create en event for your Stop button. You have issues with needing to press either Button A or Button B to get your program to stop. Use an event to see when the Stop button has been pressed and pass a true out from the event structure to terminate the while loop.
Now, the other problem that you have is that the main body of your loop is making your alternate buttons invisible again. I don't think you want to do this. Button B sets them to be visible but you immediately make them invisible again.
Beyond that, I have no idea what you actually want to accomplish with the Alternate buttons so I can't really give you any advice on what to do.
10-08-2018 12:33 PM
But, if I do this, "alt1 button" like an event. I will not be able to start button B first.
Basically, this is a small example code that I did because I have a large interface, and I want to press the B button to activate two other buttons in a menu that will decide what value the "knob" will control. That is, it would be two events (the "alt 1 ..." menu appears and when I click send information), which I can not do.
10-08-2018 01:01 PM
You can certainly design your UI such that those buttons are not visible at the start and some other event is required for them to become active. However, the current example is always disabling them. As an experiment, move the property nodes which make the button invisible outside of your loop and then try running your code. You will see that they are not available until after you have pressed button B. Then if necessary you can have some other event disable them again. However, you cannot disable them every iteration of the loop because that means they will never become active. At least not long enough for the user to interact with them.
10-08-2018 01:17 PM
Your tip worked to make the buttons active.
Now my question is how to do when clicking the button that has active, and direct the data from the "Knob" to the display Alt1 or Alt2.
10-08-2018 01:27 PM
You can use a local variable in the other event cases to read the current value of the control. Generally you should avoid using local variables and use wires to pass your data around. However, UI programming is a valid time to use them when you need to get the most current value in multiple event cases within an event structure.
10-08-2018 03:48 PM