Skip to main content
Participating Frequently
December 7, 2008
Question

[CS4] ScriptUI palette - focus problem

  • December 7, 2008
  • 18 replies
  • 7154 views
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
This topic has been closed for replies.

18 replies

Participant
February 11, 2011

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.

Known Participant
February 11, 2011

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

Known Participant
February 11, 2011

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

Known Participant
February 1, 2010

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

Known Participant
February 17, 2010

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

Marc Autret
Legend
February 11, 2011

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

Steven__
Inspiring
June 26, 2009

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

Steven__
Inspiring
May 4, 2009

Sadly 6.0.2 still does nothing for this issue.

Steven

engcoAuthor
Participating Frequently
February 26, 2009
>> (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?
December 11, 2008
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?
Inspiring
December 8, 2008
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>
December 8, 2008
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.
Inspiring
December 8, 2008
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>
Known Participant
December 8, 2008
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