Change Button Name
draudio
Posts: 8
Is it possible to change a button name from code (using ^BMF for example)?
I am using keyboards and keypads for user input, and need to parse for different types of input. I understand the return string is prefixed with the Text Area Button Name. I would like to change this name on the fly when the Keypad or Keyboard is called up to facilitate parsing.
I guess the alternative would be to copy the Keyboard multiple times with a unique Text Area Button Name for each one, but this doesn't seem to be an elegant use of resources...
Any ideas?
Thanks!
I am using keyboards and keypads for user input, and need to parse for different types of input. I understand the return string is prefixed with the Text Area Button Name. I would like to change this name on the fly when the Keypad or Keyboard is called up to facilitate parsing.
I guess the alternative would be to copy the Keyboard multiple times with a unique Text Area Button Name for each one, but this doesn't seem to be an elegant use of resources...
Any ideas?
Thanks!
0
Comments
Rather than rely upon the text string coming from a button, you could simply leave the button's text blank and fill it from the program. You do this by doing a send_command 'text<button number>-<some text>' command. You determine the button's vari-text port and number in TPD4. (or TPD3 as well).
It's different from the Channel port and code. They can actually be different values if you wish.
So, when the user calls up the keyboard or keypad, you quickly populate all the buttons with the correct characters and then flag a variable that tells the program which mode they're in. So, if the keypad is in 'number mode' you quickly send a '1' charactor to that vari-text button and a hit on button '1' means the number '1' has been pushed. If they are in 'vegetable mode' you quicly send a 'carrot' string to the button and a hit on button 1 means 'carrot'. (bad example, but you get the idea..)
I do this all the time in situations like lighting zones or distributed audio zones.
I don't want to hand-write every possible light or audio source select in every possible zone. So, I leave the buttons blank and populate their values when the customer accesses them. In most cases they don't even see it happen.
I also do this for XM channel selects or Cable favorites. I allow the customers to have up to 100 favorites they can set themselves. It would be madening to do this by hand. Let the program do it.
you say you use string output from button names to see what you should do with that button press? Or you keep a list in your code which tells you what to do according to certain 'flags'?
For example, I have a keypad for entering time to set clocks. Different clocks get set to different times, so I want to determine from the text area return string which clock button has called up the keypad. That way I can set the time on the appropriate clock. The values for the buttons are always the same, but they have to go different places.
I suppose I could set a mode flag when the KeyPad is called, then use that to direct the output.
No, I don't use the string output of the button at all. I leave the button's text field blank(what the user sees on the TP) and populate it from the program.
I just use plain-old BUTTON_EVENTs to know which button was pressed. What that button means is based upon the current mode.
alright