Facility Control

 View Only
  • 1.  De-select / de-focus a droplist?

    Posted 07-09-2020 15:08

    I have several droplists on my grid file which run some code when a selection is made, and that works nicely. However, one thing I would like to change is that after the code has run, I would like to switch focus away from the drop list, as it is left with a blinking cursor at the end of the text of the selected entry (which is read only, or course) which is somewhat distracting. 

    Now, if I click on a read only parameter elsewhere on my panel, the focus changes, and the cursor goes away. How can I accomplish 'de-select me' in code to make it cleaner than 'just click on something else' ?

    I'm sure there must be a way, but I haven't figured it out yet!



  • 2.  RE: De-select / de-focus a droplist?

    Posted 07-09-2020 15:17

    You could create an empty label, and after the choice is made use ogscript.focus("labelid") to force the focus to that label.

     

    Here is example panel I just created to see if it would work.

    <abs contexttype="opengear" gridsize="20" id="_top" keepalive="false">
    <meta>
    <params>
    <param access="1" constrainttype="INT_CHOICE" name="list" oid="list" precision="0" type="INT32" value="3" widget="list">
    <constraint key="1">one</constraint>
    <constraint key="2">two</constraint>
    <constraint key="3">three</constraint>
    </param>
    </params>
    </meta>
    <label height="20" id="label" left="80" name="my label" style="txt-align:west;" top="120" width="360"/>
    <param expand="true" height="40" left="80" oid="list" top="160" widget="combo" width="440">
    <task tasktype="ogscript">ogscript.focus("label");</task>
    </param>
    </abs>

     

     


    #DashBoard


  • 3.  RE: De-select / de-focus a droplist?

    Posted 07-09-2020 15:32

    Perfect! I was on the right track, but I couldn't get the syntax right. That works for me :)


    #DashBoard