11-21-2009 12:44 PM
11-21-2009 01:05 PM
You don't!
Simply configure the Vi to run when openend.
Write it as a event driven state machine that always runs and closes when you're done.
(Users of your program should not need to learn LabVIEW specific procedures such as operating the toolbar. Hide it during runs!)
11-21-2009 01:11 PM
Well maybe i didnt make myself clear 🙂 i WANT to add a start new game button, within the VI
11-21-2009 01:22 PM
That's just a state change in a state machine. No need to re-run the program. Make sure the VI does not stop when the game is over, but enter a "game over" state, for example. 😉
11-21-2009 01:36 PM - edited 11-21-2009 01:38 PM
Don't get me wrong, you can do this in LabVIEW, but it's silly. There is no need for it.
Have a look at the attached code (LV 8.5) that I wrote quite a while ago to demonstrate the idea. Unzip all into one folder, open autostart.vi, and click the button on the front panel. It is just a quick draft and would need significantly more work to be even generally useable.
This is a silly little example that shows how one could use an Xcontrol to run a VI via a front panel button.
Make sure everything is inside the same folder, then open autostart.vi in LabVIEW.
Pressing the button on the FP runs the VI.
11-21-2009 02:14 PM
OMG!! are serious, isn't there a simpler code????????? Do you need all these sub VIs?? BTW, i wish u cld help me in this, how can i keep the value in the string indicator WITH releasing the 4 buttons. As in, i have 4 buttons, if i press one of them, it keeps pressed and the value remains indicated, if the button is released, the value disappears.
Please see the VI if you have time.
11-21-2009 02:19 PM - edited 11-21-2009 02:21 PM
I don't see a string indicator....
Try changing the mechanical action of the buttons to "switch until released", maybe?
11-21-2009 02:28 PM
11-21-2009 02:33 PM - edited 11-21-2009 02:36 PM
rebghb wrote:
Darn, i meant numeric indicator, u see when u add convert array to number, it gave me 1 for up, 2 for dow, 4 for left and 8 for right... how can i fix these values??
Values 1, 2, 4, 8 are not broken. So why do you want to "fix" them?
(There are 16 possible combinations if you allow multiple buttons to be true).
Alternatives:
11-21-2009 02:46 PM
Ahh, maybe you want the numeric indicator continue to display the last action....
--> Use an event structure and update the value only if one of the buttons goes ON.