LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 01/02/2007

Try NumText.FormatString. 🙂
 
It is readable and writeable at runtime.
 
You have to e a bit careful, because:
  • The control size will resize vertically if you add or remove lines, possibly messing with your FP layout.
  • An invalid format will cause an error, so make sure to handle it properly.



Message Edited by altenbach on 01-04-2008 04:21 PM
Message 11 of 18
(3,725 Views)
A case I found that has different behaviour: Control type: U32. Data Format: "0x%x 0d%d". Here I'm trying to use the 0x and 0d to emulate the radix. Problem is that you can only change the decimal part in the control if you DONT select the beginning "0d" (as it does when you double-click), otherwise it will display the decimal equivalent of the hexadecimal value. Hexadecimal side behaves as expected. I had to change the format specifier to: "0x%x %dd" to work around this.

Hitting return in the first screenshot will get you 0xFFEE 0d65518. Doing the same thing in second screenshot (by typing 32768) gets you the correct hex value as in the 3rd screenshot.




Bill M.


Message Edited by Bill@NGC on 01-26-2008 04:05 PM
Download All
0 Kudos
Message 12 of 18
(3,632 Views)
Whoa, the hex part does NOT behave completely as expected with: "0x%x %dd". Double-click on it, type in a 0 and watch what happens. A format specifier of: "x%x %dd" seems to be "bug" free while still satisfying my requirement.

Bill M.
0 Kudos
Message 13 of 18
(3,625 Views)

I came across this very interesting nugget.

I was wondering whether it is possible to add symbols into such a numeric display.

So e.g.  one could have: 'Distance = 5.3 mu' but then mu written as greek symbol ...

 

Steven

LV8.5

0 Kudos
Message 14 of 18
(3,199 Views)

Yes you can.

(I have Greek language installed in my PC.)

0 Kudos
Message 15 of 18
(3,181 Views)

There is no need for greek language. Here's an example (Indicator and digital display of a knob, LabVIEW 8.5).

 

 

 

Message Edited by altenbach on 10-27-2008 12:14 AM
Download All
Message 16 of 18
(3,178 Views)

Exactly what I was looking for.

 

However it is not completely clear to me how you have done that. When I copy your entry from in the format string box (Distance = %.1f µm) into another one the 'mu' remains. But when I copy the 'mu' sign from, say, the front panel or a text editor into the format string box it transforms into a regular 'm'. So how did you get the 'mu' sign into the format string box in the first place? And why does a simple copy - paste of the 'mu' symbol not work?

 

Steven

0 Kudos
Message 17 of 18
(3,163 Views)

I just opened "charmap" (start...run...charmap) and copied from there. As long as you stay within the first ~256 characters, you might be OK (?).

 

That's how I do it. I haven't really studied this in detail. Note also that the position and presence of the µ depends on the selected font.

Message 18 of 18
(3,141 Views)