0 Replies Latest reply: Sep 21, 2014 3:26 AM by yannick1976 RSS

    How do I set focus (programmatically) to my extension ?

    yannick1976 Community Member

      Hello all !

       

      As the title says I am trying to set focus to my extension from jsx.

      The reason is I won't received keyboard events if the panel doesn't have focus.

       

      I tried different things but none of them works. What I tried :

       

      1. Toggling panel visibility :

      function openPanel(Name) {
          var desc1 = new ActionDescriptor();
              var ref1 = new ActionReference();
              ref1.putName( charIDToTypeID('Mn  '), Name);
          desc1.putReference( charIDToTypeID('null'), ref1 );
          try{
          executeAction( charIDToTypeID('slct'), desc1, DialogModes.NO );
          }catch(e){}
      };
      
      openPanel("MyPanel");
      
      

      This works (toggles panel) but doesn't set the focus on the panel.

       

      2. Setup an event to call javascript from jsx (that works perfect), and then using javascript focus() method :

      window.focus();
      
      

      That doesn't work. Nothing happens. But I saw this doesn't work in Chrome

       

      3. I searched through the API and saw things that look close (in particular the com.adobe.PhotoshopLoseFocus does... just the opposite).

      But couldn't find what I was looking for.

       

      Any ideas...?

       

      Thanks in advance !

       

       

      Yannick