LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String Constant Justification

Okay this might be a little OCD (or CDO because my OCD-ness wants it to be in alphabetical order), but I've noticed that the justification of string constants on the block diagram are different if the constant is made from a Create >> Constant, or the empty string constant.

 

So lets say I drop down a String Constant from the String palette.  It will be left justified, when new lines are entered it is quite obvious.  But if you drop down a Trim String.vi and right click the input and choose Create >> Constant.  That constant will now be right justified.  This appears to be the case for all Create Constants that create a string.  NI can you be consistent?  Am I going crazy and bigger things matter?  Thanks.

0 Kudos
Message 1 of 9
(4,247 Views)

I don't really have an answer here but it might make you feel a little less crazy that this behavior is already documented in CAR #60898.  I also looked for ini tokens or environment options to change the default justification behavior but could not find anything.

 

I think your post has also put the Cannot Unsee Curse on me.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 9
(4,210 Views)

Curse you hoovah.

 

Now that I know this it will be impossible to avoid. This does also seem to explain why I could never remember which way string constants expanded when typed into, which annoyed me when trying to make everthing look neat and tidy. At least now that the cause is known I can remember to simply work off one method of generating strings, either that or go through justifying everything.

 

0 Kudos
Message 3 of 9
(4,185 Views)

@Hooovahh wrote:

 

So lets say I drop down a String Constant from the String palette.  It will be left justified, when new lines are entered it is quite obvious.  But if you drop down a Trim String.vi and right click the input and choose Create >> Constant.  That constant will now be right justified.  This appears to be the case for all Create Constants that create a string.  NI can you be consistent?  Am I going crazy and bigger things matter?  Thanks.



If you think about it, this makes perfect sense. The constant would expand naturally to the left as you enter text into it. If you edit a constant created from the palette, it can overrun the node as you type.

 

Following the standard of code flowing from left to right, this would keep your block diagram looking nice and clean when editing. I'll bet it was always this way...

 

The question for me would be, did the addition of block diagram cleanup require significant amounts of extra coding to evaluate the justification and size of every constant to determine the absolute coords to be used to locate the text?

Message 4 of 9
(4,159 Views)

Great discussion guys, on such a small function.  I agree with the expand left to not put text on top of a subVI or other node.  But how often do you drop down a constant, type stuff, and then leave it?  For me almost never.  I will create a constant type what I want, then move it where I want it to go.  Rarely do I have a function that has an input and where the constant is made is sufficient, usually because there are many other inputs and I need to move things around a bit to not have things hidden behind wires.

 

BTW this behavior is the same for numeric constants so I'd assume PhillipBrooks assesment is correct.

 

This was discovered because during a code review of a JKI state machine, someone mentioned that the developer should stick to a string justification of either right or left, not to mix them.  After playing around this was found as the reason, the some constants were made one way some another.  Scripting to the rescue!

 

EDIT:  But now that I think about it numeric constants are fine, because they are limited to one line.  The justification doesn't matter from a readability stand point, just a string with multiple lines is affected.

0 Kudos
Message 5 of 9
(4,147 Views)

I'm with Phillip on this being intended and sensible behaviour. In fact I curse every time I forget and drop a string constant where I want it to be (next to a vi input) and start typing only to have it expand and cover my vi. I kick myself and say, "You fool, why didn't you just right click and create constant!" Left expanding constants are just what you want in such cases!

0 Kudos
Message 6 of 9
(4,121 Views)
Ohhhh... OCD and dyslexic. Chill Brian, there are way more important things to worry about: like for instance why isn't there a terminal pattern where there are terminals that exactly line up with named unbundlers. Now THAT is important.

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 9
(4,093 Views)

@mikeporter wrote:
Ohhhh... OCD and dyslexic. Chill.

It wasn't even me that found it in a code review, so I figured if someone else was more OCD than me then I should post it to the community.

 

As for the bundle by name, I put the terminal labels on the side (quick drop CTRL+T) and then vertically compress and it fits perfectly for a bundle by name.  Is this not what you were talking about?

 

bundle by name.png

 

EDIT: Nevermind I realize you are talking about a subVI yeah that doesn't happen to me too often.  Errors on the bottom, some reference or class on top, and with a 32 by 32 icon there isn't any room to try to fit bundle terminals.

 

Double EDIT:  Really there isn't one pattern that is the right size?  Even with rotating it?  I found some that are so close but nothing yet.

0 Kudos
Message 8 of 9
(4,081 Views)

@Hooovahh wrote:

@mikeporter wrote:
Ohhhh... OCD and dyslexic. Chill.

It wasn't even me that found it in a code review, so I figured if someone else was more OCD than me then I should post it to the community.

 

As for the bundle by name, I put the terminal labels on the side (quick drop CTRL+T) and then vertically compress and it fits perfectly for a bundle by name.  Is this not what you were talking about?

 

bundle by name.png

 

EDIT: Nevermind I realize you are talking about a subVI yeah that doesn't happen to me too often.  Errors on the bottom, some reference or class on top, and with a 32 by 32 icon there isn't any room to try to fit bundle terminals.

 

Double EDIT:  Really there isn't one pattern that is the right size?  Even with rotating it?  I found some that are so close but nothing yet.


And when/if you found one, you change Windows version with a different default font and booommm, all the neatly lined up wires go in bends when connected to a bundle or unbundle by name!!!! That is freaking worrysome for a true OCD person!

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 9 of 9
(4,057 Views)