08-28-2015 02:41 PM
Is it possible to create a table control to take numbers only? I know it is possible to have a two dimensional array of numbers but the user interface for the table is a much better usere experience. The keyboard navigation and the ability to have different length columns are key features.
John
08-28-2015 02:46 PM - edited 08-28-2015 02:46 PM
I've limited inputs before by just programmatically changing them back (or removing offending characters) once the user has triggered a Value Change event. You might even be able to do it with a Key Down event.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
08-28-2015 07:07 PM
08-29-2015 11:15 AM - edited 08-29-2015 11:28 AM
You can start here, but invert the logic.
However, this can be difficult. Make sure you don't disable editing keys such as left/right arrow, backspace, delete, etc. Also remember to allow the decimal point as well as the "E" or "e" in case the user enters number in exponential format (e.g. 1E5 for 10000). You might also want to allow SI units, such as "1M" for 1e6, "1n" for 1e-9, etc. Regular numerics allow all that!
08-29-2015 01:13 PM
08-29-2015 02:25 PM
@mikeporter : "It's not trivial, but it's not rocket science either."
I am Belgian (I speak French) ... i like this expression.
08-29-2015 08:56 PM
08-31-2015 01:57 PM
I was hoping to find my original code, but It was taking too long to track down, so I just made another example just for the numeric.
I like using listboxes, as I said, due to aesthetics, but also because they have some more events available to them, which I utilize here. You could certainly do this for a table if you wish, but it may not be as easy.
There is a shortcut I made here that I would not do in a final implementation. I am converting the number to a string and back again for editing the cell. I typically would store the data in its native format and only convert to the string data so I don't lose anything to rounding. Here, I am only showing one decimal point, and so if I type in a value with more than one decimal, the information is permanently lost due to this example.
08-31-2015 06:00 PM
e.g. 1E5 for 10000
Nobody should enter "1e5" when they mean "10000".
😉
Blog for (mostly LabVIEW) programmers: Tips And Tricks
08-31-2015 06:49 PM
@CoastalMaineBird wrote:
e.g. 1E5 for 10000
Nobody should enter "1e5" when they mean "10000".
😉
Exactly. I would just enter 10k! 😄