Facility Control

 View Only
  • 1.  Keypad to control the Xpression's sequencer

    Posted 08-20-2022 15:45
    Hello,

    I've developed a keypad that I can type the scene ID and press TAKE button to control the Xpression sequencer. In my view, everything was set correctly, however, the keypad does not work as expected. Could you help me, please? You'll find the code bellow. The Xpression server has IP address 10.79.31.134 and my machine IP address 10.79.31.128. 

    Code lines:

    <abs baseurl="file:/C:/Users/Abekas/Desktop/Several_Panels/XPression_Panels/TesteKeyPad.grid" bottom="-2" contexttype="opengear" gridsize="20" id="_top" keepalive="false" left="-1" right="1" top="2" virtualheight="921" virtualwidth="1498">
    <meta>
    <ogscript handles="onkeyrelease" targetid="number_entry">checkEnter(event);</ogscript>
    <ogscript handles="onkeyrelease" targetid="keypad">checkEnter(event);</ogscript>
    <params>
    <param access="1" maxlength="0" name="take_id" oid="take_id" type="STRING" value="" widget="text"/>
    <param access="1" constrainttype="INT_NULL" name="Frame_buffer" oid="0x2" precision="0" type="INT16_ARRAY" value="1;1" widget="spinner"/>
    </params>
    <api>function addNumber(num) {
    ogscript.focus("keypad");
    var value = params.getValueAsString('take_id', 0);
    new_value = value + num;
    params.setValue('take_id', 0, new_value);

    }

    function clearNumber() {
    params.setValue('take_id', 0, "");

    }
    function checkEnter(event){
    var keyCode = event.getKeyCode();
    var keyText = event.getKeyText(keyCode).toLowerCase();
    if (keyText == "enter"){
    sendTake();
    }}

    function sendTake(){
    var value = params.getValueAsString('take_id', 0);
    if (value == "" || value == null){
    ogscript.debug("No number is entered");
    }
    else{
    ogscript.debug("TAKE " +value);
    rosstalk.sendMessage('10.79.31.134', 7788, 'TAKE '+value+':0;1:0');
    clearNumber();
    }
    }</api>
    <context contexttype="opengear" id="XPression.1" objectid="10.79.31.134:8020:XPression" objecttype="XPression"/>
    </meta>
    <param expand="true" height="40" id="number_entry" left="140" oid="take_id" showlabel="false" top="60" width="140"/>
    <label height="40" left="60" name="Take ID:" style="txt-align:west" top="60" width="60"/>
    <abs height="300" id="keypad" left="60" top="140" width="720">
    <simplegrid cols="4" height="180" left="0" rows="3" top="0" width="260">
    <button buttontype="push" name="1">
    <task tasktype="ogscript">addNumber(1);</task>
    </button>
    <button buttontype="push" name="2">
    <task tasktype="ogscript">addNumber(2);</task>
    </button>
    <button buttontype="push" name="3">
    <task tasktype="ogscript">addNumber(3);</task>
    </button>
    <button buttontype="push" name="Take">
    <task tasktype="ogscript">sendTake();</task>
    </button>
    <button buttontype="push" name="4">
    <task tasktype="ogscript">addNumber(4);</task>
    </button>
    <button buttontype="push" name="5">
    <task tasktype="ogscript">addNumber(5);</task>
    </button>
    <button buttontype="push" name="6">
    <task tasktype="ogscript">addNumber(6);</task>
    </button>
    <button buttontype="push" name="Clear">
    <task tasktype="ogscript">clearNumber();</task>
    </button>
    <button buttontype="push" name="7">
    <task tasktype="ogscript">addNumber(7);</task>
    </button>
    <button buttontype="push" name="8">
    <task tasktype="ogscript">addNumber(8);</task>
    </button>
    <button buttontype="push" name="9">
    <task tasktype="ogscript">addNumber(9);</task>
    </button>
    <button buttontype="push" name="0">
    <task tasktype="ogscript">addNumber(0);</task>
    </button>
    </simplegrid>
    </abs>
    </abs>



    ------------------------------
    João victhor Mariano
    ------------------------------


  • 2.  RE: Keypad to control the Xpression's sequencer

    Posted 08-22-2022 11:33
    Hi João
    Can you provide more details about what you are expecting to see vs. what you are actually seeing?
    I notice that you have key release listeners set for what is likely a text entry field and on the <abs/> that backs your keypad. You are setting focus to the abs but it is not actually a focusable control (the buttons are and the text field would be).
    If the issue is that hitting 'enter' is not triggering your events, you may want to request focus to your text field instead of the abs.

    If you want 'Enter' to work if the text field does not have focus, you could attach a keyboard shortcut (in the application preferences) to fire a GPI trigger to the panel when the key is pressed and a text field is not focused. 



    ------------------------------
    James Peltzer
    Ross Video
    ------------------------------



  • 3.  RE: Keypad to control the Xpression's sequencer

    Posted 08-29-2022 14:53
    I had a similar problem when I was setting up my Stream Deck.  I had to make sure the command said Numpad 1 or something similar to that as it wouldn't recognize it.

    Not sure if that will help but might be worth a try.


    ------------------------------
    Brad W. Smith
    WESTMAN COMMUNICATIONS GROUP
    ------------------------------