Jump to content

Indicator clearing programmatically


crelf

Recommended Posts

Hi everyone,

Without boring you all with the tedious details I have a requirement to programmatically clear (set to their default value) front panel indicators (e.g. string and Boolean). There may be many indicators (~100) on the front panel so addressing each individually (via property nodes, say) is not a practical option. A catch-all solution, such as the "Clear indicators when called" VI property (but programmatically), is required. The idea is to create a sub-VI that will do this and that can be re-used in many different applications to carry out this action.

Now, I have come up with a few solutions to this, ranging from very clunky to just about acceptable. However, I would be most interested to see how you LV gurus out there might go about the problem, as I'm always keen to find the neatest solution to such problems. I'd also be interested to know if this requirement is something that others have needed in the past. I'll post my solutions (well I call them solutions!) if anybody's interested.

Happy New Year to you all. Best wishes.

Link to comment
Hi everyone,

Without boring you all with the tedious details I have a requirement to programmatically clear (set to their default value) front panel indicators (e.g. string and Boolean). There may be many indicators (~100) on the front panel so addressing each individually (via property nodes, say) is not a practical option. A catch-all solution, such as the "Clear indicators when called" VI property (but programmatically), is required. The idea is to create a sub-VI that will do this and that can be re-used in many different applications to carry out this action.

Now, I have come up with a few solutions to this, ranging from very clunky to just about acceptable. However, I would be most interested to see how you LV gurus out there might go about the problem, as I'm always keen to find the neatest solution to such problems. I'd also be interested to know if this requirement is something that others have needed in the past. I'll post my solutions (well I call them solutions!) if anybody's interested.

Happy New Year to you all. Best wishes.

If you just have to re-initialize the controls to default, why not use the reinitialize to default method of the VI class.

post-5746-1167601211.png?width=400

Link to comment

Omar, thanks for the suggestion but I don't think that'll work for me. I want to clear my front panel indicators but leave my front panel controls with their current values. I think the VI property you suggest clears everything, both indicators and controls.

Michael, your method is interesting. Didn't know it existed! However, I can't seem to create a valid reference for the Panel property node, always get the invalid object reference error when I run it (any suggestions because I like the sound of this technique?). However, if I use your suggestion but use a Pane property node I can get this to work along the lines that you suggest.

To achieve what I want to date I've been using either of two similar methods, one based on the invoke nodes Contol Value: Get All [Flattened] and Contol Value: Set [Flattened], and the other based on the invoke nodes Contol Value: Get All [Variant] and Contol Value: Set [Variant]. These both give me the ability to return only indicator information and hence set only indicator values. Each has a potential problem though.

The variant method returns no type descriptors. This means I have to adopt an ugly, brute force, inefficient approach. I have string and Boolean indicators that I want to clear. So I set ALL these indicators to an empty string then set ALL these indicators to a Boolean false. This works but of course generates errors: you can't set a string indicator to a Boolean false nor a Boolean indicator to an empty string. To avoid seeing the errors I break the error cluster wire appropriately and disable the sub-VI's automatic error handling. Yuck!

The flattened method does return type descriptors. This means that I can see what type (string, Boolean etc.) the indicator is then clear it (set it to its default value) appropriately. What worries me here though is what if one day NI decide to change/re-assign LabVIEW's type descriptor values? My code won't work. Are the type descriptors liable to change or are they set in stone?

Regards, Graeme.

Link to comment

Michael, I've got something working. Is the attached VI (IndicatorClearerPanel) the sort of thing you meant? I've also attached my "flattened" version of it to see if anyone has any comments. Certainly with your method (if I've got it right) it's much more obvious what's going on, quite intuitive really. It would be interesting to compare the execution speeds but I can't do this as I'm only running the Base Development system.

Regards, Graeme.

Download File:post-5820-1167657933.vi

Download File:post-5820-1167657950.vi

Link to comment

Thanks Mike - I should have just put up the BD in the first place.

Many thanks to you and Michael for pointing me down this road.

No worries Graeme - sometimes it's just about hunting through the properties and methods until you find something that'll get the job done :D

PS: you might want to check this out at around 11:30 tonight, London time... ;)

Download File:post-181-1167668503.vi

Link to comment

Ha ha, I like it crelf, very witty indeed. Fortunately I'm Scottish though, just happened to have lived in England most of my life, so not too fussed about the cricket (just as well). Soccer's a bitter pill to swallow though...

Thanks again guys.

Graeme.

Link to comment
Ha ha, I like it crelf, very witty indeed. Fortunately I'm Scottish though, just happened to have lived in England most of my life, so not too fussed about the cricket (just as well). Soccer's a bitter pill to swallow though...

No worries me old mate (you must be enjoying the Ashes series almost as much as I am then ;) )

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.