The main purpose of programming is to achieve a user's function, the user by using the mouse, keyboard, program, etc. to trigger some kind of program action, so as to achieve a certain result, these operations are called events, LabVIEW corresponding theseThe most common structure of events is the event structure. The event structure is rich in content, and the structure of the event is essentially a large program structure, which is described in detail below. event structures cannot respond to events individually in a program, and must be used in conjunction with a looping structure, such as <ignore_js_op> events are added in a simple way, the right mouse button event box pop-up menu, such as add, delete, copy, edit events and other options, follow the action. For example, to add a stop event to the event structure, the Boolean control triggers the event in a variety of ways, mouse down, past, left, enter, and so on, where we select "Value change". once determined, the stop event is added, such as when we run the program, clicking the Stop button on the front panel, triggering the event to stop the while loop and then the program stops. <ignore_js_op> can only one event be added to the same event branch? Of course not! There are times when there are many different operations that execute the same code, and how does programming make the code redundant? See an example, such as 2 button STOP1,STOP2 Click can let the program stop, how do we add events for it? <ignore_js_op> Let's add an event STOP1 first, as described above. because STOP2 's execution code and STOP1, we edit this event branch on the event Stop1, right-click popup menu (Edit event Handled by this case) will pop up the edit box that added the event stop1, This is the left side with 2 buttons as follows <ignore_js_op> We click on the Add event to the left of the events list to see the following changes
<ignore_js_op> When this is selected, the right-hand list selects Stop2 's Value change event, click OK to see the event branch below, 2 events are added in the same branch, after running the program, click Stop1 or STOP2 can let the program stop. <ignore_js_op>
timed out
The timeout is unique to the event structure, and the name will know what is going on, that is, the timeout event is executed without triggering the event for a certain amount of time. If the time-out setting is <=-1, the timeout event is never executed and the loop is in an idle wait state. For example, if the setting time-out is 100, then a timeout event is executed if no event is triggered for more than 100ms. <ignore_js_op> Therefore, if the program event function is not many, but also need to execute a piece of code at a time, you can consider this way to complete, if the program is frequent, it is not recommended to use this event to schedule code execution. Add Event method learned, some people in the programming when the click button down, found that the front can not respond to other events, it seems to be locked in front of the same, this is why? We know that adding an event is going to have an event edit box, which is already there, and you notice there's a options? <ignore_js_op> This option means that the front panel is locked if the event box is not completed. See this you should understand the above problems, so sometimes we decisively remove this option. OK, the problem is solved. |