LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to open global front pannel from Main.vi

Hi,

I have Main_wkGlobal.vi and kGlobal.vi. How can I open the kGlobal when I start the Main_wkGlobal instead of manually open and run kGlobal ?

Thanks,

 

KN

 

Download All
0 Kudos
Message 1 of 8
(2,691 Views)

Well fisrt off kGlobal.vi can't run.  It is a global variable there is no code to run

 

Your code has some problems and should be re-thought out.  Use an event structure to respond to user inputs.  This way you won't burn up the entire CPU re-calculating the same result as often as possible.  Seriously, you only need to calculate and update the display when A, B or the operation changes.

 

What you have is a first-class case of localitis and global abuse.  Not to mention that you forgot the programmer's mantra "Code it once!"

 

A quick revision uses no locals, no globals and no greedy loops

Main_wkGlobalJB_BD.png

and attached back saved to 8.6 per vi properties


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 8
(2,678 Views)

Hi Jeff,

Thank you very much for your quick reply. I am learning how to use global, and this is just simple code for learning.This example: I have to open Main_wkGlobal.vi and open kGlobal.vi, then changing the option on the kGlobal.vi the result will calculated on Main_wkGlobal.vi. My question is how to open the kGlobal.vi when I start the Main_wkGlobal.vi ? That mean when I start Main_wkGlobal.vi the kGloble.vi will pop up.

Again thank you very much for your help.

 

KN

0 Kudos
Message 3 of 8
(2,656 Views)

Well if you MUST, (And I discourage you from abusing a global like that its not what they are designed for)

 

!1-1.png

The FP.Open method works well on Globals Set "Activate="TRUE" to put key focus on the global (even in 8.6 I had to double check that the method would save back that far)


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 8
(2,647 Views)

Hi Jeff,

How can you get the copy of kGlobal sign ?

Thanks,

KN

0 Kudos
Message 5 of 8
(2,636 Views)

A static VI reference constant is available in the functions palettes Programing>Application control. Drop it on your BD.  Rightclick and browse for the global or drag the globals icon into the reference.

 

I assume you tried creating a constant from the invoke node.  That will create a strict static reference and you won't be able to drop a global into that.


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 8
(2,629 Views)

Hi Jeff,

Thank you very much for your help. It's working for me.

 

KN

0 Kudos
Message 7 of 8
(2,619 Views)

I don't have a development environment available right now, so I can't try it out - but I believe that the Global Variable Front Panel will be removed from compiled code and may not function as you expect it to.

 

I appreciate you are learning how to use Globals Variables, but I will just add that I very rarely use them. There are several much safer tools available for sharing data between threads

_____________________________
- Cheers, Ed
0 Kudos
Message 8 of 8
(2,602 Views)