LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have an explicit '+' sign in numeric controls?

Solved!
Go to solution

Hi,

 

I was looking for a possibility to show the sign of a numeric value in numeric controls, i.e. the control should display either '-1.2345' or '+6.789' because this value will be added to or subtracted from some other parameter value. Accordingly, no sign, i.e. '6.789' is not meaningful in this case.

 

Unfortunately, I found no possibility to do so (CVI8.5.1). I do not want to use a text control where this would be possible, because I'd like to have the up/down arrows to scroll up or down. Did I miss something trivial - or is ist really not possible? Seems so simple and natural...

 

Many thanks,

 

Wolfgang

0 Kudos
Message 1 of 8
(4,920 Views)

Can you explain your difficulty a bit more clearly? If you programmatically retrieve a number from a signed integer numeric control in order to perform calculations with it, the presence or not of the optional '+' sign on the corresponding display is irrelevant. What exactly are you trying to achieve?

 

JR

0 Kudos
Message 2 of 8
(4,913 Views)

Hi JR,

 

I want to see the sign on the control. So far, positive numbers are displayed without a sign. Usually, this is ok. For this particular application I'd like to have the + sign explicitely displayed.

Wolfgang

 

 

0 Kudos
Message 3 of 8
(4,910 Views)

I'm not sure you can do it ...

 

If it's just for displaying information ... Use a String Control and sprintf("%+f",value);

Message Edité par Neb37 le 12-03-2008 10:51 AM
0 Kudos
Message 4 of 8
(4,905 Views)

Thank you for the suggestion. However, I need a hot (active) control permitting the user to change the displayed value. I was looking for something analogous to padding, where a numeric value is preceeded by zeros. In my case, I would like to have the sign (plus or minus) precede the number.

 

Unfortunately, this seems not possible. Therefore I considered a text control, where one could do the trick with some extra work (read value, redisplay it with + sign), but the text string misses the up/down arrows for easily changing the numeric value.

 

May be NI could consider this as a (minor) wish for a future maintenance release?

 

Have a nice day,

Wolfgang

0 Kudos
Message 5 of 8
(4,865 Views)
Solution
Accepted by topic author Wolfgang

Hello Wolfgang,

 

We'll add this as a product suggestion. In the meanwhile, have you tried catching the up and down keypress events in the string control callback and increment/decrement the value yourself?

 

By the way, would you still expect to see a '+' sign when the value in the control is 0? Or no sign at all, in that case?

 

Luis

Message Edited by LuisG on 12-05-2008 12:04 PM
0 Kudos
Message 6 of 8
(4,847 Views)

By the way, would you still expect to see a '+' sign when the value in the control is 0? Or no sign at all, in that case?


 

Make it an option  😉

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 7 of 8
(4,823 Views)

Hello Luis,

 

thanks for the consideration. Thanks, too, for the suggestion of using the up/down events. I came up with another idea, which involves two controls, sitting on top of each other: The text control on top; the width of the text control is smaller, and both are right aligned, so one sees the up/down arrows from the numeric control, and the text control. This has the benefit that the control looks (almost) like all the other numeric controls, and it can be operated like all the other controls, by clicking the up/down arrows.

 

For the display of zero, it would be nice to have the '+' sign displayed, too, as this will indicate that nothing is added. (In my application, there are several signals that may be delayed relative to each other, and the control displays the relative time delay of signal i+1 to signal i. So if a signal is delayed, it should read +12.3456 s, if it is synchronous, it should read + 0 s, and if it is earlier, -0.00789 s would be fine)

 

Of course, having +0 or 0 is more general and might be even better for other cases.

 

Have a nice weekend,

 

Wolfgang

0 Kudos
Message 8 of 8
(4,810 Views)