24 Replies Latest reply on Feb 11, 2011 1:05 AM by Dr. TYPO

    [CS4] ScriptUI palette - focus problem

    engco
      Does anyone know of any changes to ScriptUI's focus behaviour?

      My palettes (Windows XP) now seem to grab various keystrokes (such as backspace, cursor) regardless of where the cursor is placed. This happens not just to my own scripts but also, eg, Dave Saunder's WrapNudger script or the SnpCreateDialog sample snippet. Needless to say, all scripts behave impeccably under CS3. It makes no difference if the script is placed in a previous version folder or not.

      Does anyone have a clue what might be going on?

      David
        • 1. Re: [CS4] ScriptUI palette - focus problem
          Level 1
          David,

          I'm not seeing that behavior on my G5 running OS X 10.4.11. Which computer are you using and which operating system?

          Dave
          • 2. Re: [CS4] ScriptUI palette - focus problem
            engco Level 1
            Hi Dave.

            I'm using Windows XP. (Did say!)

            I can't believe this is intended behaviour, but on the other hand, I just can't see what the problem might be. All non modal ScriptUI windows are unusable on my machine and since it happens to your script and to the sample scripts I'm confident that examining the script itself will reveal the problem.

            Is it a bug with the windows version? (I'm suffering from an unrelated problem with Acrobat 9 which turns out to be Windows-only). Is there some wierd problem because I still have CS3 installed? (Unfortunately, not all plug-ins are available yet with CS4 compatability, so I have to keep CS3 installed for the moment). Or is there some other problem that I've missed?

            So, do you have definite confirmation that WrapNudger works OK with CS4 on Windows XP? If so, it would help limit the source of the problem.

            Thanks for the help.

            David
            • 3. Re: [CS4] ScriptUI palette - focus problem
              engco Level 1
              whoops! I did of course mean I'm confident that examining the script itself will NOT reveal the problem.

              David
              • 4. Re: [CS4] ScriptUI palette - focus problem
                [Jongware] Most Valuable Participant
                The difference I see is that the palette gets deactivated in CS3 if you click outside it, whereas in CS4 it's still activated. A quick Alt-Tab away and back to CS4 leaves it in a de-activated state, and then everything works fine. Until you select the palette again.

                (It's spooky what key presses ID figgers should "go into the active palette": cursor and backspace, yes, regular keys and return, no. I heard on the product fora about dialogs that 'ate' some keypresses and put others right into your document.)

                Tried with the very same WrapNudger file, copied into CS3 and CS4. Smells like a bug, all the way from here.

                [Edit: you don't have to Alt-Tab away. You cannot deselect it by clicking in the document, but it does work with mouse clicks on (some of the) panels and the menu bar.]
                • 5. Re: [CS4] ScriptUI palette - focus problem
                  Level 1
                  And the fact that it works properly on Macs strengthens the feeling that this is a bug in the Windows version of InDesign CS4. Could one of you Windows guys report it here, please:

                  http://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

                  Thanks,

                  Dave

                  PS: Sorry for not noticing your "Windows XP" in parens, David.
                  • 6. Re: [CS4] ScriptUI palette - focus problem
                    engco Level 1
                    Thanks, guys, for helping confirm this is a bug. jongware - the behaviour you describe is exactly what I see, including the spookiness. Tab goes into the document, backspace is grabbed by the palette). In practice, the bug makes any script using a non modal window unusable in Windows.

                    David
                    • 7. Re: [CS4] ScriptUI palette - focus problem
                      Level 1
                      Fellow Scripters,

                      For whatever it's worth, this seems like a ScriptUI problem, not an InDesign problem per se. Does anyone have a non-modal ScriptUI panel in Photoshop or Illustrator? If you do, could you verify the problem?

                      Thanks,

                      Ole
                      • 8. Re: [CS4] ScriptUI palette - focus problem
                        Eric @ MCA Level 3
                        >And the fact that it works properly on Macs strengthens the feeling that this is a bug in the Windows version of InDesign CS4.

                        Which is not to say we don't have weird issues happening with kbd focus on the Mac side!

                        Select some text in a text frame.

                        AS: Run this Applescript from Script Editor:

                        tell application "Adobe InDesign CS4"
                        display dialog "Hello world!"
                        end tell

                        Now try and dismiss the dialog with the Return or Enter key. Say... where'd that selected text underneath the dialog go?!

                        I reported this a while back. Hopefully being fixed in 4.01...
                        • 9. Re: [CS4] ScriptUI palette - focus problem
                          Level 1
                          Hi Eric@MCA,

                          True, but at least there's an easy workaround in this case (use the dialog object rather than display dialog).

                          There's another Mac OS thing with Suitcase--something were you can't enter text in InDesign fields when font auto-activation is turned on, or something like that. I wonder if they're related?

                          Thanks,

                          Ole
                          • 10. Re: [CS4] ScriptUI palette - focus problem
                            sstanleyau Level 4
                            On 9/12/08 8:43 AM, "Olav Kvern" <member@adobeforums.com> wrote:<br /><br />> but at least there's an easy workaround in this case (use the dialog object<br />> rather than display dialog)<br /><br />Not if you need a third button, though.<br /><br />The other workaround is to have no default button, which means no button<br />named *exactly* "OK". So:<br /><br />tell application "Adobe InDesign CS4"<br />display dialog "Hello world!" buttons {" Cancel ", " OK "}<br />end tell <br /><br />Note the spaces around the Cancel too -- if you don't use them, you get a<br />new answer to the recent question about how to change tools to the selection<br />tool :-)<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
                            • 11. Re: [CS4] ScriptUI palette - focus problem
                              Eric @ MCA Level 3
                              Hi Olav,

                              Thanks for the response!

                              Yeah, they asked that question, but I don't think so. We don't have Suitcase installed on the machines I'm installing CS4 on for testing. And it happens on a fresh, default install of CS4. I have no trust at all for font autoactivation either, so those extensions never get installed.

                              Also, it doesn't happen on the earlier beta of CS4 that the Biscotti devs were distributing, so my theory is that it got introduced later in the dev cycle somehow.

                              As for using the dialog model, that is true but a huge pain compared to the ease of the display dialog. (Unless I am woefully ignorant of a way to generate a simple OK/Cancel dialog via dialog model.)

                              I usually only break that out if I actually need to build a custom dialog with more than a Continue or Cancel? question. And also, the scripts work correctly when run from within the InDesign scripts panel at least. It is only in thetrip from Script Editor to InDesign that display dialog breaks.
                              • 12. Re: [CS4] ScriptUI palette - focus problem
                                sstanleyau Level 4
                                On 9/12/08 9:35 AM, "Eric @ MCA" <member@adobeforums.com> wrote:<br /><br />> And also, the scripts work correctly when run from within the InDesign scripts<br />> panel at least.<br /><br />In which case you can always resort to:<br /><br />tell application "Adobe InDesign CS4"<br />    do script "display dialog \"Hello world!\""<br />end tell<br /><br />Slower, and mucks with the cursor, though...<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
                                • 13. Re: [CS4] ScriptUI palette - focus problem
                                  Eric @ MCA Level 3
                                  Yah, that's definitely not a conversion I want to have to do to my 100 or so ID scripts...

                                  At any rate, the point for Adobe to take away from this is that no, this has *nothing* to do with Suitcase plugins and needs to be fixed in 4.01 please?
                                  • 14. Re: [CS4] ScriptUI palette - focus problem
                                    engco Level 1
                                    >> (Message 6) "In practice, the bug makes any script using a non modal window unusable in Windows".

                                    Sadly, the release of Indesign 6.01 doesn't do anything to fix the problem of floating palettes grabbing keystrokes. I don't understand why there isn't a chorus of complaints - are there no other Windows scripters whose scripts have been killed by CS4?
                                    • 15. Re: [CS4] ScriptUI palette - focus problem
                                      Steven.. Level 3

                                      Sadly 6.0.2 still does nothing for this issue.

                                      Steven

                                      • 16. Re: [CS4] ScriptUI palette - focus problem
                                        Steven.. Level 3

                                        Unfortunately this issue doesn't seem to be going away any time soon. To clarify in reference to Olev's question, this is an InDesign only issue. After Effect supports modeless dialogs and doesn't have the issue. I tested Photoshop using bridgetalk while writing text on image and didn't have this bug. Using bridgetalk and InDesign gave me the same issue. This hasn't been fixed in 6.03 and as long as its not defined as InDesign only issue will not be fixed.

                                        Steven

                                        • 17. Re: [CS4] ScriptUI palette - focus problem
                                          Dr. TYPO Level 1

                                          Hello!

                                           

                                          I've got the same problem with this little palette:

                                           

                                           

                                          #targetengine "session"
                                          //same problem with own target engine
                                          
                                          var pal = new Window("palette", "focustest", undefined, {resizeable:true, closeButton:true});
                                          
                                          pal.st = pal.add("statictext", undefined, "bla:");
                                          
                                          pal.show();
                                          

                                           

                                           

                                          As in the original post already said: the palette eats some keystrokes (e.g. I can type "y" but not "a"), the focus remains on the palette.

                                           

                                          Is it possible to work with an eventhandler, someting like "onMouseOut focus the layout"?

                                           

                                          I'm running InD 6.04 on WinXP... is there a solution for this problem or has somebody a workaround?

                                           

                                           

                                          Best regards,

                                           

                                          TYPO

                                          • 18. Re: [CS4] ScriptUI palette - focus problem
                                            Dr. TYPO Level 1

                                            ok... here's the workaround:

                                             

                                            #targetengine "session"
                                             
                                            var pal = new Window("palette", "focustest", undefined, {resizeable:true, closeButton:true});
                                             
                                            pal.st = pal.add("statictext", undefined, "some static text...");
                                            
                                            FocusInDesign = pal.addEventListener("mouseout", LeaveTestPalette);
                                            function LeaveTestPalette() {
                                                indesign.reveal();
                                                }
                                            
                                            pal.show();
                                            

                                             

                                             

                                             

                                            --> the eventhandler brings InDesign to the front when you leave the palette.

                                             

                                            Well, it's still not good: the palette loses the focus too early (as soon as you leave the static text field).

                                             

                                            Do I have to work with coordinates of the palette in order to determine if the mouse pointer has really left the palette?

                                             

                                            Can somebody please help on?

                                             

                                             

                                            Thanx,

                                             

                                            TYPO

                                            • 19. Re: [CS4] ScriptUI palette - focus problem
                                              muxamil

                                              Is there any solution for this? I am having the same issue, and the workaround i am using is to send focus to indesign as soon as cursors leave the pallete boundaries. If there is a fix for this issue, can someone share a link to that.

                                              • 20. Re: [CS4] ScriptUI palette - focus problem
                                                Dr. TYPO Level 1

                                                Hello muxamil,

                                                 

                                                I haven't found any solution. And if you use my workaround in a startup script, this will mess up other things randomly.

                                                Ain't no fun... so I gave up (for the moment).

                                                 

                                                 

                                                Cheers,

                                                 

                                                TYPO

                                                • 21. Re: [CS4] ScriptUI palette - focus problem
                                                  Marc Autret Level 4

                                                  Dr. TYPO wrote:

                                                   

                                                   

                                                  #targetengine "session"

                                                  var pal = new Window("palette", "focustest", undefined, {resizeable:true, closeButton:true});

                                                  pal.st = pal.add("statictext", undefined, "some static text...");

                                                  FocusInDesign = pal.addEventListener("mouseout", LeaveTestPalette);
                                                  function LeaveTestPalette() {
                                                      indesign.reveal();
                                                      }

                                                  pal.show();

                                                   

                                                   

                                                   

                                                  --> the eventhandler brings InDesign to the front when you leave the palette.

                                                   

                                                  Well, it's still not good: the palette loses the focus too early (as soon as you leave the static text field).

                                                   

                                                  Do I have to work with coordinates of the palette in order to determine if the mouse pointer has really left the palette?

                                                   

                                                  • The problem with working with mouse coordinates is that the palette title bar seems to be out of the scope of ScriptUI. I mean that no mouse event is listenable within this specific area. The mouseout event is notified to the palette (at-target) as soon as the mouse leave the drawable area, excluding the title bar.

                                                   

                                                  • However you can significantly improve your event handler by ignoring any event target which is not the palette itself —don't forget that the mouseout event bubbles (http://www.w3.org/TR/DOM-Level-3-Events/#event-type-mouseout). Thus you bring ID to the front only when you actually leave the palette drawable area:

                                                   

                                                  #targetengine "mySession"
                                                   
                                                  var pal = new Window("palette", "focustest", undefined, {resizeable:true, closeButton:true});
                                                   
                                                  pal.st = pal.add("statictext", undefined, "some static text...");
                                                   
                                                  pal.addEventListener('mouseout', leaveTestPalette);
                                                  
                                                  function leaveTestPalette(/*MouseEvent*/mev)
                                                       {
                                                       if( mev.target instanceof Window ) app.activate();
                                                       }
                                                  
                                                  pal.show();
                                                  

                                                   

                                                  Does that help?

                                                   

                                                  @+

                                                  Marc

                                                  • 22. Re: [CS4] ScriptUI palette - focus problem
                                                    Dr. TYPO Level 1

                                                    oh, I forgot to mention "Extendables", which can be found under extendables.org, discussions can be found on this forum.

                                                    To me it looks quite promising...

                                                     

                                                    I've tested the example "ui.jsx" in the examples folder of the extendables download.

                                                    There I've created a ui palette via "new ui.Palette()", unfortunately with the other misbehaviours.

                                                    Although it creates a palette with correct focus, you're not able to type characters other than "qyswxrtup" into a text box.

                                                     

                                                    But maybe this hint will help? If you find a solution, let me know, ok?

                                                     

                                                     

                                                    Cheers,

                                                     

                                                    TYPO

                                                    • 23. Re: [CS4] ScriptUI palette - focus problem
                                                      Dr. TYPO Level 1

                                                      Hello Marc,

                                                       

                                                      that was quick :-)

                                                       

                                                      thanx & I'll try!

                                                       

                                                      ***

                                                      • 24. Re: [CS4] ScriptUI palette - focus problem
                                                        Dr. TYPO Level 1

                                                        Hello Marc,

                                                         

                                                        this helps :-)

                                                         

                                                        thanks a million!

                                                         

                                                        //TYPO