04-26-2021 12:43 PM
Hi, to anyone that can help me with this, I would really appreciate it. Is it possible to change the values of a number by ones, tens, hundreds and thousands? I'm trying to create a VI with this feature, more specifically in a control. I want to change ones or thousands in a single control or in a way that lets me change the value to any number I like. Thanks in advance.
04-26-2021 01:12 PM
Hi Stardust,
@Stardust95 wrote:
Is it possible to change the values of a number by ones, tens, hundreds and thousands?
Yes, sure!
@Stardust95 wrote:
I'm trying to create a VI with this feature, more specifically in a control. I want to change ones or thousands in a single control or in a way that lets me change the value to any number I like.
Then why don't you attach your VI?
What have you tried?
Where are you stuck?
Do you get any error messages?
04-26-2021 01:30 PM
If you mean to do this manually: Use the text tool to select (highlight) on digit. Then the increment/decrement buttons will apply to that digit.
04-26-2021 01:49 PM
I've tried, but only using 2 controls (both with sliders), you use both sliders to sum or subtract the desired number, and then a 3rd button to make the operation. What I want is to change the 2 sliders and merge them into 1, or find a way to perform the 2 operations with only 1 control. Fortunately, I have 0 error messages regarding my VI.
04-26-2021 02:09 PM - edited 04-26-2021 02:11 PM
You found the way more complicated way to do things. You even found the action "Latch Until Released" which I have never found a good use for.
Attached is much easier.
Don't forget a wait statement in there as your VI makes my CPU run hot.
An event structure would be even better.
04-26-2021 02:12 PM - edited 04-26-2021 02:14 PM
04-26-2021 02:33 PM
@paul_cardinale wrote:
If you mean to do this manually: Use the text tool to select (highlight) on digit. Then the increment/decrement buttons will apply to that digit.
You don't even have to highlight the digit, just place the cursor next to it. And the up/down buttons on keyboard will do the increment/decrement operation. No code or buttons necessary.
04-26-2021 02:50 PM
Yep, this is useful, thanks for the response 😄
04-26-2021 02:52 PM - edited 04-26-2021 02:59 PM
Yep, just a question, is there a way to put arrow keys instead of the slider? I mean in a numeric control itself, or is this the only way possible to do it? Thanks for the help. 😄
Edit: is there a way to make the add and subtract buttons into one? Just curious.
04-26-2021 03:12 PM - edited 04-26-2021 03:17 PM
@Stardust95 wrote:
Yep, just a question, is there a way to put arrow keys instead of the slider? I mean in a numeric control itself, or is this the only way possible to do it? Thanks for the help. 😄
Edit: is there a way to make the add and subtract buttons into one? Just curious.
For first question: look into Event Structures. You will need to use one in order to capture the "Key Pressed?" event. I've attached a VI that demonstrates the approach you should take.
For second question: No. A button has 2 states: True, False. You need at least 3 states for it to work correctly (increment, decrement, unpressed).
Edit: Just realized I maybe misread your first question. Are you expecting arrow keys to control the size of increment (because that's what the slider does), or to control the act of incrementing like my posted code does?