01-07-2024 05:54 AM
Hello everyone,
I know how to do an event with key down using char but if I add to the same event a boolean button the option dissapears. My question is do you have an example of where an event is called when pressing a button or pressed a certain keyboard value?
Thank you
01-07-2024 10:24 AM
The Event structure is designed to respond to a particular Event, at the time the Event occurs. It is vanishingly unlikely that two Events, such as a Key Press and a change in the value of a Boolean control, would happen at exactly the same time (unless your CPU is running on a 10 millisecond cycle clock).
When you process an Event (say, a Key Down event), inside the Event Case you can make a decision about "what to do" by putting a Case Statement controlled by a Boolean, to do one thing if the Boolean is True (pressed) and something else if it is False, but it would be using the state of the control at the time the Key Down event happened, unless you put code inside the Key Down Event to, say, wait 2 seconds for the user to press a Boolean button and do one thing if True and another if False.
Bob Schor
01-07-2024 10:37 AM
If several events share an event case, only event data nodes are available that a common to all events.
A boolean change does not have a "char", so once you add that, you can no longer have that event data node.
There are simple solutions to this, but I don't want to randomly guess what would be appropriate for your situation, because you have not give any details. What does the event do?
Once you share a simplified example of your code (VI, not a picture!) we can give further advice.
01-10-2024 03:54 AM
Hi, in this case is for Log In. I want that the enter an the pressing the log in boolean to do the same. Thank you
01-10-2024 10:41 AM
Assuming this is a string control, you can do the following:
If a string control is set to "limit to single line", pressing <enter> will accept the entry instead of inserting a new line into the control.
01-10-2024 11:49 AM
@eneko.mujika wrote:
Hi, in this case is for Log In. I want that the enter an the pressing the log in boolean to do the same. Thank you
What is stopping you from making them separate events within the Event Structure? You can wire them up doing the same action.
I've attached a (very crude) example that could work for what you're wanting. I am sure other forum members can do better.