• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Palette regain focus

Guide ,
Oct 23, 2012 Oct 23, 2012

Copy link to clipboard

Copied

Hello,

Our palette can change the current page and document through a list. The user clicks on the list and the palette changes the current view. If the myPage is on the current document this works well. If we have to change the document to show the new page, the palette goes out of focus and we can't use the up/down arrows.

                                                  app.activeDocument = myDoc;

                                                  app.activeWindow.activePage = myPage;

Is there a way of regaining the focus?

Thanks.

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 11, 2012 Nov 11, 2012

Copy link to clipboard

Copied

Hi Pickory

I had my bash at this. No luck what so ever!

Did you find a solution yet?

Just for a bit of encouragement for others to help find a solution below is the basic code just missing the one (or more) line of code.

Regards

Trevor

#target indesign

#targetengine session

var myDocs=app.documents.everyItem().name,

       w = new Window ("palette");

var docs = w.add ("listbox", undefined, myDocs, {multiselect: false, });

     docs.onChange = function ()

    {

    app.activeDocument=app.documents.itemByName (myDocs[docs.selection.index]);

    // Missing magic line to regain focus on the selection ??????????????????????

     };

w.show();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

does "w.active=true" work? (can't test right now)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

No

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

how about using dispatchEvent() to send a "activate" event to the palette?

something like:

var myEvent=new UIEvent;

myEvent.type='type';//i guess activate??

w.dispatchEvent(myEvent); //???? just taking wild guesses here

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

Hello,

I didn't find a work around.

I did think about having a plugin do all the page and document selecting, just haven't got round to it yet.

P.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 12, 2012 Nov 12, 2012

Copy link to clipboard

Copied

LATEST

You might be on the right track but it's beyond me.

Let the world know if you come up with a solution that works tried and tested

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines