> I am using labview 5.I want to implement some event driven
> programming.
> I have a few buttons on the frront panel and I want to use the same
> button to trigger different events one by one.For example, first when
> I press the button a selection list should pop up.And once that
> occured, when I press the same button again some other action should
> be triggered without affecting the selection list.
> I have heard that in LABVIE 6.1 event structures are present which can
> be used to get event driven programming.But how to do this in LABVIEW
> 5.The problem is that I can program the button to trigger the first
> action and the lisst will pop up.But how to program the button to do
> another action if I press the button again without affecting the
> result of the first action.
I'm not sure I fully understand the behavior you want so I'll describe
several things.
If the list popping up is a small dialog, then you need only one control
on the panel. It is like the OK button in the palette in that it
latches -- it pops back out when read. Your diagram will read the
button periodically, about ten times a second is common, and when the
button is TRUE, take action. The action taken is not just dependent on
the state of the button, but also on some stored information about the
history of the button. This calls for a diagram that remember some
state, or a state machine.
Your diagram will have a loop that ensures that you read the Boolean at
a given rate, and the loop internally will have a case structure that
takes action depending on the state of the machine. Your decision
inputs are obviously the button state, and also the value of a shift
register. The shift register belongs to the loop and can be initialized
outside the loop. If it is a couter of button presses, then initialize
it to zero. If it is a Boolean indicating the count is zero or nonzero,
then initialize it to FALSE. The next part is a matter of opinion. You
need to combine the logic to make three states, which would normally
amount to three cases in the case structure. One case/state for Button
not Pressed. One for First Button Press, and one for Subsequent Press.
Combine your decision variables, the button state and the history
state to select one of the three.
There are examples of state machines, and probably the best thing to do
is search developer zone, zone.ni.com for it.
Greg McKaskle