LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 08/24/2009

Does it bother you that you have to use values of 0, 1, or 2 to set the disabled state of a control/indicator?  It never really bothered me, I guess because I just got used to it.  But lots of people think that it should be an enum instead.  Well, I don't know how it didn't make it into the Upgrade Notes, but have you seen the Disabled Property in LabVIEW 2009?

 

new_disabled.png

 

So now you don't have to do a number-to-state translation in your head whenever looking at the Disabled property.  Of course, you're also losing a lot of diagram real estate.  I'll let you decide if it's worth it or not.  As for existing code, your old U8 constants will stick around, and you'll see a coercion dot on the property:

 

disabled_coercion.png 

 

I wouldn't worry about the coercions, they're not hurting anything.  I don't plan on going through all my existing apps to change them over, although I will probably start using the enum in new apps.

Message 1 of 19
(6,975 Views)
I use this so often I created a disabled property enum in my templates/reuse files years ago.
PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 2 of 19
(6,959 Views)
NoSir.jpg
Richard






Message 3 of 19
(6,923 Views)
I can't say it bothered me, however the enum makes it clear exactly what is going on when someone new would look at the code (or for that matter, when I go back and look at something done years ago).  I think this is a good move, though I can't say I'm a fan of the screen realestate required for "Disabled and Grayed Out".
0 Kudos
Message 4 of 19
(6,902 Views)

<severely off-topic, unless you know where Broken Arrow's image came from>

You know, I tried watching a Ren and Stimpy episode the other night...just didn't make me laugh like it did in college.  Same thing happened when I watched Spaceballs as an adult.

</severely off-topic>

Message 5 of 19
(6,900 Views)

I still never remember the numbers (or I'm always unsure if they are correct). So every time I need to check the help to see that 0 is enabled.

I will like that feature once I get an upgrade.

 

Felix 

0 Kudos
Message 6 of 19
(6,898 Views)
I'm wondering why not use shorter names for the enum. Like enbld, disbld, disbld gyd or something that makes more sense... Guess it'll serve the purpose of clarity and real estate... The point is, I hate such big enums... :(... In fact I dislike the File Handling enums too! They take so much of space...
Message 7 of 19
(6,883 Views)

NitinD wrote:
I'm wondering why not use shorter names for the enum. Like enbld, disbld, disbld gyd or something that makes more sense... Guess it'll serve the purpose of clarity and real estate... The point is, I hate such big enums... :(... In fact I dislike the File Handling enums too! They take so much of space...

See the comments in this idea. You may wish to add your own in there as well.

Message 8 of 19
(6,864 Views)

I always wondered why the enum was not here in the first place, I cant think of a large scale application that I didnt use this property.  Now that it is here it does raise an interesting issue with graphical programming, real estate is a premium (this was not effercted by the recent real estate bubble).  If this was a text based language, using a #typdef is a nobrainer, the code is much more readable and maintainable with little to no disadvantage.  That said I will probably use the enum over the U8.  I keep most of my GUI architectures in a queued state machine and much of my properties are set in a seperate state (where there is plenty of real estate) so I dont have to stuff a property node in too often.

 

 

 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 9 of 19
(6,563 Views)

Once upon a time it was policy of NI to remove as much enums from the IDE as possible, since they all need to be localized for every IDE language, something that was basically not possible, so I wonder how this looks in the french or german version of LabVIEW.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 10 of 19
(6,557 Views)