12-03-2014 09:33 AM
Hi to all,
I'm trying to get a numeric control with a suitable addition for the order of magnitude.
For example, I have a frontpanel for an osziloscope, sometimes I sample over a few ns, sometimes some seconds, sometimes a few milivolts, sometimes several volts, who knows, right 😉
I was playing around with the units of numeric controls, but this doesn't quite fit my needs. I can change the prefix of a unit on runtime, e.g. from microseconds to seconds, but then I have to change the number as well, because on changing the prefix, the previous number is only muliplied by the according factor, e.g. by 1000, so 5 us become 5e-6 s. So changing the record length from the default value of 500ms to 100ns would require two klicks and typing, and instead I can just type '100e-9' which is good as well.
However, I would like to have an numeric control from 0 to 1000 combined with e.g. a dial knob for the prefix i.e. nano, micro, mili etc. and combine this values internaly, i.e. mulitplying accordingly. But I couldn't set the increment to "3 orders of magnitude" even with the log scale option.
I'm aware, I could use an enum with the according names and values, but thats not very satisfying.
So maybe the question would be: Is it possible to combine two numeric control, one or the value and one for the prefix, in a suitable and easy way? Or how do you handle numerical values over several orders of magnitude in a case like mine?
Thanks for your answers in advance,
Best,
bastlwastl
Solved! Go to Solution.
12-03-2014 09:40 AM
Display format == SI units
It helps in these situations
12-03-2014 09:45 AM
12-03-2014 09:49 AM
I usually just use the SI notation in the display of my numerics. Then you can see the prefix as part of the control. You can actually type "1M" into any numeric control and the value will be 1,000,000.
12-03-2014 10:41 AM
Hi,
the display format in SI-units is nice, i didn't knew this. Thanks.
The "enum-solution" would require some kind of wrapping or extra code to get the correct value, and it will always be 2 objects. The "Display-format-solution" will give me the right value directly and it's only a single object, in case I want to change something programaticaly, like setting a readout value. Then code will get mesy when I have to distiguish between "single-object"-objects and "combined-object" where I have to respect to enum value etc.
Why complicated when it could be easy?
Thanks for your answers,
Best
bastlwastl
12-03-2014 10:49 AM - edited 12-03-2014 10:53 AM
@bastlwastl wrote:
Hi,
the display format in SI-units is nice, i didn't knew this. Thanks.
The "enum-solution" would require some kind of wrapping or extra code to get the correct value, and it will always be 2 objects. The "Display-format-solution" will give me the right value directly and it's only a single object, in case I want to change something programaticaly, like setting a readout value. Then code will get mesy when I have to distiguish between "single-object"-objects and "combined-object" where I have to respect to enum value etc.
Why complicated when it could be easy?
Thanks for your answers,
Best
bastlwastl
"Simple" and "complicated" depends on who you ask. 😉
For someone more used to using an O-scope than fooling around with a computer, having a front panel that reminds them of the instrument they are used to using is a lot simpler than trying to enter numbers into a box. The more you make it look like the instrument it is emulating, the simpler the learning curve. Indeed, I've used front panels that were so close to the real instrument that I didn't even have to think twice about what I was doing. I didn't need anyone to explain to me what each know did.
Developers sometimes forget who they are developing for.
Besides, you'll have to generate extra code to weed out invalid values - like, say, negative numbers - anyway.
[edit] even if it is an engineering tool, give some thought to the front panel. You never know when it is going to become a full-fledged application. [/edit]
12-03-2014 11:03 AM
@billko wrote:
"Simple" and "complicated" depends on who you ask. 😉
Definitly 😉
Limits are set rather easily on the numeric control itself, but i couldn't handle the orders of magnitude.
But it brings me back to the initial problem, that i can't set the increment of a numeric control to "1 order of magnitude", right? For example, if the user must chose between 1, 10 and 100ms for whatever, I must use an enum? Unsatifying, if i wan't to imitate the look of an instrument, which might be a knob. What can i do then?
Best,
bastlwastl
12-03-2014 11:05 AM - edited 12-03-2014 11:11 AM
Log Scale on the knob!
12-03-2014 11:09 AM
But then e.g. 2ms is possible if I use an increment of 1ms. But i wan't to restrict the values to 1, 10 and 100. Or is the increment then logaritmic as well?
12-03-2014 11:12 AM