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

ScriptUi listbox extending beyond window until resize

Contributor ,
Apr 07, 2016 Apr 07, 2016

Copy link to clipboard

Copied

I know this is not specifically about InDesign scripting but it will be incorporated into an InDesign script and InDesign scripters have a reputation as being the smartest!

What I am finding is when a listbox is larger than the window it extends beyond the window and is not reachable. If I apply a layout.resize() function to the window onResize event, the listbox fixes its self when I resize the window.

var w = new Window('dialog', undefined, undefined, {

        resizeable: true

    });

   

    w.orientation = 'row';

    w.alignChildren = 'top';

    w.maximumSize.height = 400;

   

    var myList = w.add ('listbox');

    myList.alignment = ['fill', 'fill'];

   

    var item;

    for (var i = 0; i < 200; i ++) {

        item = myList.add('Item', i);

        item.checked = true;

    }

   

    w.onResizing = w.onResize = function() {

        this.layout.resize();

    }

   

w.show ();

Screenshot-2016-04-08-09.33.09.gif

How do I make it so that the listbox fits within the window on show?

Also a second little issue: I am having troubles where the checks are not displaying when I scroll through them quickly. When I click on the item with the missing check marks they suddenly appear. This seems like a refresh issue. Is there something I can do to fix this as well?

TOPICS
Scripting

Views

902

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

correct answers 1 Correct answer

People's Champ , Apr 07, 2016 Apr 07, 2016

For the first issue, add an onShow event:

w.onShow = w.onResizing = w.onResize = function() {


I'm not able to reproduce the second issue, though.


Ariel





Votes

Translate

Translate
People's Champ ,
Apr 07, 2016 Apr 07, 2016

Copy link to clipboard

Copied

For the first issue, add an onShow event:

w.onShow = w.onResizing = w.onResize = function() {


I'm not able to reproduce the second issue, though.


Ariel





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
People's Champ ,
Apr 08, 2016 Apr 08, 2016

Copy link to clipboard

Copied

I second Ariel. Adding handler to onShow event does the trick.

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
Community Expert ,
Apr 09, 2016 Apr 09, 2016

Copy link to clipboard

Copied

LATEST

McShaman -- You should set the maximum size of the list, not the window.

Peter

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