Home AMX User Forum NetLinx Studio

Make a Keyboard - Using text-input button

Hi at all!
I 'm remaking a user keyboard to insert text into my project.
Where can I find documentation about text-input button? How it works?
Thanks alessandro

Comments

  • I never did a keyboard from scratch....

    You may use a keyboard popup from the Panel system page template. They are just popup pages, and can be copied into your panel. Now you can rename the popup, change the design, etc. to fit to your existing design.

    Hint: If you check the button properties of the textbox of the keyboard, in General tab, in "Text" the default is KEYB- This is the identifier you'll get sent by the panel from the keyboard when you push "Done" (i.e. when typed 'Hello' and you push Done, the panel sends 'KEYB-Hello'). But this is also the default identifier from the internal keyboard (i.e. called by 'AKEYB-')
    To easily differ between the onboard keyboard and your redesigned one, rename that name to something different, like 'KEYB_MINE-' (now you get 'KEYB_MINE-Hello').
    If you need additional keyboards for different functions, just copy that popup.
  • eddymouseeddymouse Posts: 67
    Thanks. How can I change the port number?
    When I push DONE the panel send a STRING to master on port 10001:1:1. How can I change it?
    Thanks
    Alessandro
  • eddymouse wrote: »
    Thanks. How can I change the port number?
    When I push DONE the panel send a STRING to master on port 10001:1:1. How can I change it?
    Thanks
    Alessandro

    Unfortunately this is a limitation. The strings always are sent on port 1.
    Workaround (i.e. in a UI module):
    DEFINE_DEVICE
    dvMyPanel = 10001:3:0
    
    DEFINE_EVENT
    DATA_EVENT[dvMyPanel] // this one works on the defined port. Can't be used for String.
    {
    }
    
    DATA_EVENT[dvMyPanel.Number:1:dvMyPanel.System]
    {
    // works on port 1, althouh the dvMyPanel is defined on port 3
    }
    
  • ericmedleyericmedley Posts: 4,177
    I think you might try the string output port in the button properties window. And then do as Mark suggests. You can setup each button with a custom string that gets sent back to the master. From there it's a simple matter to parse the string.

    A long time ago I made my own keyboard using button numbers. Getting all the caps, numbers with their shifted chars and other special chars was a royal pain. However, once it was done it works nicely. You simply track the current mode of the panel and the keyboard can be used for anything very easily. A module parses the string, so to speak.
  • DHawthorneDHawthorne Posts: 4,584
    I just take the lazy way and copy the one from the system pages, then re-skin it to match my design, and rename the text window so the output is unique.
  • ColzieColzie Posts: 470
    DHawthorne wrote: »
    I just take the lazy way and copy the one from the system pages, then re-skin it to match my design, and rename the text window so the output is unique.

    Is there any way to pre-populate the text box (via code), when using this method?
  • viningvining Posts: 4,368
    By default it populates automaticlly because the text field is set up as address port "0-setup port", address code "Keyboard: Text Area - multi line" so as you type it fills in the text window and when you hit done it sends the entire contents of the text field with the name assigned to this keyboard prepended to the string to the port 1 string event handler for that TP.

    If you want to control how it populates and possibly run it through some filters you pretty much have to create your own keyboard from scratch. Use a standard address port and code for the VT and standard channel port and code for the individual keys. You could probably assign the string out port field and assign each key a single letter string and trap each push in a string event handler but I've never tried that.
  • ColzieColzie Posts: 470
    I was referring to the way you can preload the system keyboard with text via
    send_command dv_TP1, "'@AKB-preload some text;specify a title'"
    

    So the text box has something when it is shown.

    I want to capture a user name, and if it is already set I want to display it for editing, etc.
  • viningvining Posts: 4,368
    From AMX PI:
    "'AKEYB-<initial text>'"
    
          Pop up the keyboard icon and initialize the text string to that
    
           specified. Keyboard string is set to null on power up and is stored
    
           until power is lost.
    
     
    
          Syntax:
    
                SEND_COMMAND <DEV>,"'AKEYB-<initial text>'"
    
     
    
          Variables:
    
                initial text = 1 - 50 ASCII characters.
    
     
    
          Example:
    
                SEND_COMMAND Panel,"'AKEYB-This is a Test'"
    
                Pops up the Keyboard and initializes the text string 'This is a Test'.
    
    "'@AKB-<initial text>;<prompt text>'"
    
          Pop up the keyboard icon and initialize the text string to that
    
           specified. Keyboard string is set to null on power up and is stored
    
           until power is lost. The Prompt Text is optional.
    
     
    
          Syntax:
    
                SEND_COMMAND <DEV>,"'@AKB-<initial text>;<prompt text>'"
    
     
    
          Variables:
    
                initial text = 1 - 50 ASCII characters.
    
                prompt text = 1 - 50 ASCII characters.
    
     
    
          Example:
    
                SEND_COMMAND Panel,"'@AKB-Texas;Enter State'"
    
                Pops up the Keyboard and initializes the text
    
                 string 'Texas' with prompt text 'Enter State'.
    
    
    
    
    These work fine for the default keyboard but I don't see any means to call a modified renamed keyboard and loading it with initial text.
  • ColzieColzie Posts: 470
    Hence my question.... :)
  • viningvining Posts: 4,368
    Well it just so happens that the "'AKEYB-<initial text>'" command and probably the other command as well populates the modified renamed system template keyboards too. The only problem is it pop ups the system template as well.

    I beleive if you copy the system template keyboard and keep the same name and put it in a pop up group for keyboards the keyboard copy will take precedence over the system template version of the same name. You can then modify the keyboard as you wish and when you call the above command you'll pop up the remodeled version. If you also need a keyboard with a different name so you can use that name to determine its purpose and how to parse its string you can try an call the "'AKEYB-<initial text>'" command and immediately afterward in code call the pop up for the named keyboard you want. Since the group would be mutally exclusive the AKEYB keyboard probably won't be drawn and the latter called pop up will.
Sign In or Register to comment.