06-14-2018 08:17 AM
I have an idea! But I wonder if it already exists.
There's many times where I'd like to have a cross between a numeric control and a string control to allow user input of time formatted strings. Like this:
Now, it would be super cool to have validation on the input. I'm thinking of time-formatted fields in a database or web form, such that your cursor goes in to overstrike mode and you can only type numerics and can't replace the colons.
Any thoughts on implementation? I'm not aware of any obvious tricks to advance the cursor as you type.
06-15-2018 02:15 AM
What I can think of is to take a look at the IP control or Password control source code. Both custom controls ship with CVI and their code is available as well: both originate from a string control adding a callback that helps formatting text int the usual "xxx.xxx.xxx.xxx" or "*****" format respectively, that is, both of them handle the keyboard input and operate on it someway; looking into their source code you can have some guidance on your actual problem which appears very similar to at least the first one.
06-19-2018 10:41 AM
Great hint on the IP control library. I didn't even know that existed!
So I took it and simply retooled it for relative time input. Attached is the lib (TimeCtrl.h) along with a sample project which demonstrates. I didn't make a function panel out of it, as I don't use them. Maybe someone else can.