How to get Input Text from "text input" button.
davidgev
Posts: 9
Hi everyone,
I have a button, whose type is "text input" and I am trying to get the value from it using NetLinx code.
I tried the following method, but it didn't work:
SEND_COMMAND PANEL,"'?TXT-80,0'" // 80 is the address port of the button
CUSTOM_EVENT[INPUT_BUTTON_IP, 1001] // Text
{
SEND_STRING 0,"'ButtonGet Id=',ITOA(CUSTOM.ID),' Type=',ITOA(CUSTOM.TYPE)"
SEND_STRING 0,"'Flag =',ITOA(CUSTOM.FLAG)"
SEND_STRING 0,"'VALUE1 =',ITOA(CUSTOM.VALUE1)"
SEND_STRING 0,"'VALUE2 =',ITOA(CUSTOM.VALUE2)"
SEND_STRING 0,"'VALUE3 =',ITOA(CUSTOM.VALUE3)"
SEND_STRING 0,"'TEXT =',CUSTOM.TEXT"
SEND_STRING 0,"'TEXT LENGTH =',ITOA(LENGTH_STRING(CUSTOM.TEXT))"
}
When the event is triggered the TEXT is empty or whatever that was initially set in the TEXT property of the specific state.
I guess I am doing something wrong.
Can you please help me out with this issue?
Sincerely,
David Gevorkyan
I have a button, whose type is "text input" and I am trying to get the value from it using NetLinx code.
I tried the following method, but it didn't work:
SEND_COMMAND PANEL,"'?TXT-80,0'" // 80 is the address port of the button
CUSTOM_EVENT[INPUT_BUTTON_IP, 1001] // Text
{
SEND_STRING 0,"'ButtonGet Id=',ITOA(CUSTOM.ID),' Type=',ITOA(CUSTOM.TYPE)"
SEND_STRING 0,"'Flag =',ITOA(CUSTOM.FLAG)"
SEND_STRING 0,"'VALUE1 =',ITOA(CUSTOM.VALUE1)"
SEND_STRING 0,"'VALUE2 =',ITOA(CUSTOM.VALUE2)"
SEND_STRING 0,"'VALUE3 =',ITOA(CUSTOM.VALUE3)"
SEND_STRING 0,"'TEXT =',CUSTOM.TEXT"
SEND_STRING 0,"'TEXT LENGTH =',ITOA(LENGTH_STRING(CUSTOM.TEXT))"
}
When the event is triggered the TEXT is empty or whatever that was initially set in the TEXT property of the specific state.
I guess I am doing something wrong.
Can you please help me out with this issue?
Sincerely,
David Gevorkyan
0
Comments
Jeff
That worked perfectly.
One more question: I want the inputted text to be an IP address, for that reason I tried the following Input Mask - [0|255]{.}[0|255]{.}[0|255]{.}[0|255], but that doesn't work. Is this syntax incorrect?
Sincerely,
David
It seems the documentation is a little lacking (an example would be nice ), but it looks like { and } are moving to other text fields. I think what you need are literals. Try [0|255]\.[0|255]\.[0|255]\.[0|255]
Jeff
Thanks again. I tried the proposed version with literals, but that doesn't seem to work.
Will do the validation in the code, however it would be nice to have it as a mask.
Sincerely,
David
The attached zip contains a TP file that has an IPKeypad popup which is a copy of the __keypadExtend popup from the system page with a couple of minor tweaks. Five minutes of work.
You can drop the file into panel preview and you?ll see that you can type the first quad and then hit the dot key to take you to the next quad. Or you can click on any of the text inputs and then type.
The code below demonstrates the keypad in action for changing an IP. Most of the code is just error trapping for the Abort key and checking to make sure every text input has some data along with a few lines of fluff.
I?m sure there are better ways but this should give you a good start.
Have fun.
I just noticed that cIPAddress and cTempIPAddress should have been declared with a length of 15 not 14.