LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event when application starts

Solved!
Go to solution

When my program starts, I require the user to input two strings which are then used in event structures. I have created a dialog box to do this.

 

Also, if these strings need to be changed while the program is running, I have a button which fires a value change event which brings up the same dialog box, then these new values are used via shift registers for the other events.

 

Is there a way of adding an application start event to the button value change event so that the sequence of the program is:

 

Open the program

the dialog box appears

the user inputs the two strings

 ... the main program using these values ...

user clicks button the make changes

the dialog box appears

the user inputs two new strings

 ... the main program using new values ...

etc...

 

At the moment I do the first three steps outside the main program loop and there is a value change event which does exactly the same thing within the loop. This doesn't seem to be the most efficient way of doing things.

 

 

Regards,

Sebster.

0 Kudos
Message 1 of 9
(3,794 Views)

An image tells more than a 1000 words.....

so please post your current approach.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 2 of 9
(3,793 Views)

Here we go...

 

If you look in the select product value change event you'll see what I mean.

 

Thanks,

Sebster

0 Kudos
Message 3 of 9
(3,786 Views)

User EventSebster

You can create a user event (Startup) register that event then fire that event when the main loop starts.  The startup event should fire the popup dialog event.

 

 

Message Edited by VADave on 03-05-2009 06:05 AM
Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 4 of 9
(3,784 Views)

Hi Sebster,

i can't open your vi at the moment, but you can use the timeout case. Use a shiftregister for the timeout. Initialize it with 10. Connect it to the timeout terminal of the event structure. Insert your input box in the timeout event. Store your values and set the timeout to -1 if you don't need it in your application.

 

Hope it helps.

Mike

0 Kudos
Message 5 of 9
(3,782 Views)
Solution
Accepted by topic author sebster

An easy solution is to write to a signaling value property of the button before the loop starts.

 

This will queue up the event and fire it as soon as the event structure is ready to execute.

 

(To use this, you need to make your button is switch action and reset it back to FALSE inside the event).

 

Here's how it would look like:

 

 

Message Edited by altenbach on 03-05-2009 04:22 AM
Message 6 of 9
(3,773 Views)

Sebster,

 

from looking into your VI, i am not sure if you missed some basics on the event structure.

But first to answer your question:

You can create a user event like VADave explained. This is good esp. if you have to "invoke" that VI programmatically from other parts of your application.

Mike's suggestion is ok for many cases, but requires a good handling of your timeout case.

So both suggestion could be a solution. Another one would be to switch to "Producer/Consumer (Event)" and simply enqueue the repetative task. Enqueue before entering the producer once and then each time your user presses "Select Product". The consumer will handle it. 

 

Now to my remark about your understandind of the event structure:

You configured a Timeout event 3600000 milliseconds which is  3600s = 1h. Now to the point where i am not sure if you already know: This Timeout will only fire, if the user do not interact with the application for this time! If the user presses "Select Product" after e.g. 30 minutes, the Timeout "timer" will be reset and it will not fire 30 minutes after the button being pressed.....

So maybe this is desired functionallity, but i wanted to let you know. 

 

hope this helps,

Norbert 

Message Edited by Norbert B on 03-05-2009 06:28 AM
Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 7 of 9
(3,764 Views)

Now to my remark about your understandind of the event structure:

You configured a Timeout event 3600000 milliseconds which is  3600s = 1h. Now to the point where i am not sure if you already know: This Timeout will only fire, if the user do not interact with the application for this time! If the user presses "Select Product" after e.g. 30 minutes, the Timeout "timer" will be reset and it will not fire 30 minutes after the button being pressed.....

So maybe this is desired functionallity, but i wanted to let you know. 

 

 

This is the desired functionality. The purpose of the program is primarily to verify that a 3-character code is present within a barcode. This displays a giant tick or cross accordingly.

 

But also the data collected is sent to an excel file to keep a record of what is scanned against works order number. This filename will contain the current week number. Now if the PC is left on over a weekend (as normally happens) with the program running, there will be no front panel activity. The timeout event checks the current week number against what is being used - if it's different, then a new file is generated and that becomes the file to write to. I chose 1 hour for the timeout, but it could have been anything. Just to clarify a bit, does the timer reset after the timeout has fired? ie will this event fire once an hour?

 

 

I've tried altenbach's solution and, as usual, the simplest idea's are the best!! A little bit of juggling around and this is what is required.

 

Thanks very much for a simple and elegant solution.

 

Regards,

Sebster.

0 Kudos
Message 8 of 9
(3,740 Views)

Sebster,

 

the Timeout event will fire as soon as no activity occurred during the given timeout frame. So in your case, the Timeout will fire once each hour if nobody triggers other eventcases in the meantime.

So with your explanation, the Timeout should never fire during a normal work day, but during night/weekend situations.

 

Norbert 

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 9 of 9
(3,734 Views)