TP data input mask example?
Rich Abel
Posts: 104
I'd like to use an input mask when a user enters a specific tuner frequency via his touch panel.
Does anyone know where there are some examples of using input masks? I don't see any in the MVP TP documentation....It's always much easier for me to understand the application if I can see a code sample that illustrates.
Also: Can input masks be used with the built in Keypad and Keyboard pop-ups, or would I need to create my own (I'm thinking that I would need to apply the mask to the specific variable text field).
Thanks...
Rich Abel
Does anyone know where there are some examples of using input masks? I don't see any in the MVP TP documentation....It's always much easier for me to understand the application if I can see a code sample that illustrates.
Also: Can input masks be used with the built in Keypad and Keyboard pop-ups, or would I need to create my own (I'm thinking that I would need to apply the mask to the specific variable text field).
Thanks...
Rich Abel
0
Comments
Look up the range of valid radio frequencies for your country and parse based on that. FM broadcasting is between 88 and 108Mhz in the US (odd numbers on the .x numbers of course) i.e. 88.1 to 107.9 Others countries generally have broader spectrums which your regulatory agency dicates.
Do get a clear string identifier for parsing for a frequency input, do the following:
1) mark the text field on the keypad
2) in the button properties, go to "general" tab
3) rename the TEXT from KEYP- to let's say KEYP_FREQ- This now is the identifier the panel is sending you if a frequency keypad input was done.
But parsing the frequency must still be done within your code.
Thanks for the suggestions.
What I had hoped to be able to do was apply the input mask button command to the built in keypad, but I can't find a way to do this....the built in keypad lives in port 0.
I was hopeful, because the panel setup code does this on the built in keyboard when entering the IP address octets.
In the case of the FM frequency, I believe the input mask:
SEND_COMMAND dvTP,"'^BIM-4,[87|107]{.}[5|95]'"
would force the user to enter whole numbers between 87 and 107, the {.} is the next field character(decimal point), and forces the user to enter fractional frequencies between 05 and 95. At least this is what I can extract from MVP documentation.
If I can do this, it simplifies the data validation a bunch and decreases the need for error messages or help text on the TP. So it is an appealing possibility.
At this point, I think I'll have to punt. Tech support wasn't really familiar with this application.
Thanks again.
Rich
But how to format it varies with what your device is expecting as an input. I've seen tuners that automatically insert a zero after you punched in a 1 (so if you inputted 102.3, it came out 1002.3). I've seen tuners that require two decimal places, and some that only need one.
But you are right - if we could specify an input mask, none of that would be necessary.
It would be even more easy if you could make input masks like you would do in MS Access. Enables a user to only input a date, a string, or only numbers
Rich,
I think you may be able to create a custom keypad with this mask. From the File menu, click on "Open System Page Template". Copy and paste the "__keypad" popup page from the tempate file to your project file. Rename it something appropriate. Now you should be able to set the Input Mask property for the text area at the top of that page. I'm not able to try it, but I think that should work.
--D