Re: How can I obtain a reference to a global variable?

2004-03-30 Thread MartinManscher
The problem in a nutshell is that I can only access the value
of a global variable, but not the properties. With a reference,
I can access the properties through a property node.

Martin



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread Robert Cole
Gee, thanks folks. I know that it's a kind of messy way to do
something like that, but it works (even if it takes a bunch of clock
cycles). For myself, in the long run I'd probably use a functional
global.

I thought about it afterwards and wasn't sure that I'd put the example
together correctly. I tossed it together in the last couple of minutes
before leaving for a funeral. I must use LabVIEW too much since I
thought about this example a couple of times during the service.

I wonder if other people have LabVIEW thoughts while supposedly doing
other things. Should we set up a poll?

 Rob



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread MartinManscher
Thanks - that was the last bit of the puzzle for me :-)

Martin



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread MartinManscher
Well what do you know - I could upgrade my rating :-)

Martin



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread Mads
There is no way to tell LV that it is a global, it's not - it's as you
say a VI with uninitialized shift registers.

Why would you want to skip the call? One of the good things about
func.globals is the fact that they are VIs; if you try to write to it
and it's busy the code will wait the microseconds it takes and then
access it. If you add error IO you can use data flow to ensure
execution order etc. And you can add all sorts of functionality inside
it, much like an object with different methods.



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread MartinManscher
There seems to be cases where you want to skip the call, see http://zone.ni.com/devzone/conceptd.nsf/webmain/82E60E34E609C22A862569F8007E3F4A?opendocument";>Improving
Determinism with Functional Globals, LabVIEW 2-Style Globals, in
LabVIEW Real-Time - one of the few documents I found about the
topic.

But thank you for your answers - standard globals have long been a
source of annoyance, since you often want to at a little functionality
to them. I only discovered functional globals last week, even though I
have been programming LabView since version 3 :-)

I would still like to find the answer to the "Skip the call" part,
though...

Martin



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread Mads
I would use a functional global instead (generally better than
ordinary globals). That global could also hold the reference to the
listbox however instead I would just add a method to the func.global
that gives you read and write access to the listbox contents.

Since it is a global though I would perhaps skip the listbox
alltogether though and have a string array, a selection array etc. in
the functional global. Then you can read the contents without
involving property nodes every time and read it all and present it as
a listbox only where that is needed.



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread MartinManscher
I have searched quite extensively in the LabView documentation and on
ni.com to find out more about functional globals, but the information
is very sparse. Maybe it's just me overlooking something, but at first
sight, it looks simply like a normal subVI with uninitialized shift
registers. I can of course make such a VI, but it does not
automatically have the "Skip subroutine call if busy" in the context
menu. How do I tell LabView to perceive this VI as a functional
global? Or is this "Skip subroutine call if busy" a feature of version
7 (I use 6.1)?

Martin



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread MartinManscher
Agreed - in my (twisted?) mind I was just leaving the  for a more
simple, elegant way to do it - if such a method existed. But you are
right, it is certainly not Rob's fault that NI has made it so
cumbersome to do. I am therefore upgrading my rating to  (I'm not
sure I can remove the previous grading, but I'll try to add a few
s more... :-)

Martin



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread Nirmal Sharma
Hi Robert,

Pretty excellent answer

Nirmal



Re: How can I obtain a reference to a global variable?

2004-03-30 Thread Nirmal Sharma
Hi Martin,

Why do you require reference to global variable when it can be
accessed directly. I mean is there any advantage by using reference
method. I think if u eloboarte your consequences, we can share better.

Regards,
Nirmal



Re: How can I obtain a reference to a global variable?

2004-03-25 Thread Jean-Pierre Drolet
Hint: an excellent answer provided with a working example certainly
worths a ! (it's four stars rating... not "censored" =A6=AC)
It may not be the solution you expected but it is not the poster's
fault after all...



Re: How can I obtain a reference to a global variable?

2004-03-25 Thread MartinManscher
An excellent answer. Exactly what I was looking for. I had wondered if
it could be done along those lines, but did not know enough about the
"To more specific class" function to nail it myself.

Pity that it is not possible to do this directly (i.e. right-click a
global variable and select "Create > Reference" or "Create > Property
node").



Re: How can I obtain a reference to a global variable?

2004-03-25 Thread MartinManscher
Thank you for your answer.

I know how to use global variables in general, but the problem is that
a Multicolumn Listbox (MCL) referred as a global is just the number of
the selected line(s). I would like to access the contents of
the MCL, which I perceive as a table. If this is a MCL in a normal VI,
I can create a reference (and by this I mean a reference, not a local
variable), and use a property node to access the ItemNames property,
which gives me the contents of the table (I could of course also have
created the property node directly, but the reference can be passed to
subVIs).

However, if the MCL is a global variable, it is unclear how I can
create a reference or property node to access the contents. Is this
impossible, or is there something that I overlooked?

Martin



Re: How can I obtain a reference to a global variable?

2004-03-25 Thread Nirmal Sharma
Hi,

For changing the contents of any gloabal variable, you have to access
that global variable in a normal vi. Open a new vi, go to Block
diagram -> Function Pallete->Structure-> Global variable. Then right
click on this global variable-> replace by your global variable vi or
create a new global variable vi. By doing this, u  can access the
value and can change it.

Hope it helps. Your feedbacks are welcome.

Best Regards,
Nirmal Sharma