LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

time string control input validation

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:

2018-06-14 07_12_18-c__..._Documents_SVN Checkouts_SRS RGA Driver_SRS RGA driver.cws.png

 

 

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.

0 Kudos
Message 1 of 3
(2,111 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(2,078 Views)

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.

Message 3 of 3
(2,054 Views)