LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure?

Hello All

 

A quick question

 

Would the best solution be an event structure to do the following

 

Click on a mouse button to open a vi, click on the mouse button again to close this vi and open another.....repeat this action x (lets say 4 for the pedantic) times.

 

No.....no code to attach as I'm just starting to write this one and would like somebody to point me in the right direction.

 

Best regards

Ray

0 Kudos
Message 1 of 13
(3,561 Views)

Yes, an event structure would be a reasonable choice.

0 Kudos
Message 2 of 13
(3,552 Views)

Hi,

 

event structure is a reasonable choice. In the event case the dynamical call can be used to open the SubVI  front panel.

http://decibel.ni.com/content/docs/DOC-4542

0 Kudos
Message 3 of 13
(3,540 Views)

You can also do a search on Dynamic VI's.  At least you will see how they are called from a vi.  That way you'll have a reference to the vi which will be useful when you want to stop it (always do that before closing it), and to close the VI.

 

Note that closing a VI will not necessarily stop it's execution.  It would close the front panel.  The idea is to avoid keeping objects in memory.

0 Kudos
Message 4 of 13
(3,534 Views)

@rayclout wrote:

...

 

Click on a mouse button to open a vi,

click on the mouse ... to close this vi

...

and in the darkness bind them.

...


 

Please forgive the interuption. I got all liteary this week-end the thought keep bubling to the top.

 

BTW: Who is John Galt?

 

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 13
(3,529 Views)

Ben - We'll discuss John Galt in the other thread in our secret hiding place 😉

0 Kudos
Message 6 of 13
(3,513 Views)

Thanks all

I have used the event structure, not a great deal, but enough to recognise it's capabilities.

 

I'll go ahead and create my code then. If I get into trouble, can I ask for assistance from you guys?

 

BTW....Ben.......(shrugs)

 

Ray

0 Kudos
Message 7 of 13
(3,442 Views)

Kudos for nice ref Ben. 🙂

I'll think of a continuation on that.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 8 of 13
(3,423 Views)

Hi Guys

I have been able to get some code working, but have some question that someone may be able to assist with.

 

I have attached what I have been able to achieve so far. I am a little stuck from here on.

 

I'll explain the operation of the vi (or it's intended functionality) first.

 

The "OK" boolean has been sized to fit the pane. This is to allow a user to click the mouse anywhere on the pc screen to initiate an event.

 

First question. How can I get rid of the screen flicker which happens each time the mouse is clicked?

 

Next, the final vi will have 4 pages for the user to scroll through by using the mouse click.

 

Second question. How can I have the first page be the default, and open when the CIMain vi is run?

 

Effectivley the first page is the first thing the viewer(s) will see. The user can then incrementally scroll through the other 3 pages until arriving back to page 1, and this process continues in this fashion.

 

It is a requirement of the vi that a page can be left open on the pc screen until the user clicks with the mouse again OR a timeout of say 5 minutes of no user input occurs, The vi will revert to page 1 being displayed. The user has walked away from the display, and after this timeout the vi resets the display back to page 1.

 

Third question. How can I implement this timeout function? Could I use another event structure frame with a timeout inside?

 

Things to be aware of:

 

1. The LEDs used in this vi are for coding purposes only and will be removed once I get the functionality I want.

2. The "pages" will be subvi's, with simple text and data tables on the FP.

 

Any guidance will be appreciated

 

Thanks and regards

Ray

 

 

 

0 Kudos
Message 9 of 13
(3,349 Views)

There's no need for your 2nd loop, just add a OK button event.

The timeout could be realized through a timeout event set to 2 mins, if no other event occurs that'll fire.

The redraw flicker is hard to get rid of with such a big button, you could use a MouseClick event on Panel instead. That'll avoid redraws.

Why hide the LED's in the case and update through locals? Place all 4 LEDs outside the case.

You can use "Default if unwired" or wire all False to the same constant to tidy up the diagram some.

 

If you save a tab control with one page showing that page will be the default shown when reopening.

 

(I'd use a Modula divide with 4 instead of resetting and handling the page counter, but that's personal preferrence)

 

Your pages can be realized in several ways:

- 4 sub-vi's that shows front panel being the obvious.

- 1 Sub-vi with a tabcontrol

- 1 sub-vi (or the active one) where you insert sub-panels

- 1 vi server opening of sub-vi's

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 13
(3,332 Views)