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

Why is my listbox empty?

Community Expert ,
Feb 10, 2021 Feb 10, 2021

Copy link to clipboard

Copied

Dear all,

It looks that simple, the array is filled, the list box has its items - but the display is empty:

Status of script at breakpoint:

wPalC-3.png

wPalC-2.png

KLD_Z.main = function () { 
var asColours = [], oDoc, wPalC;
  oDoc = app.ActiveDoc;
  wPalC = new Window("palette", "Colours in this document");  
  wPalC.lis1 = wPalC.add ("listbox", undefined, undefined);
  wPalC.lis1.preferredSize.width = 210; 
  KLD_Z.GetColourNameList(oDoc, asColours);    // OK
  KLD_Z.FillDlgList (wPalC.lis1, asColours);   // OK
  wPalC.show();                                // NOK
$.bp(true);
} //--- end main -----------------------------------------

I have not the slightest idea what's wrong here.

TOPICS
Scripting

Views

172

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
Enthusiast ,
Feb 10, 2021 Feb 10, 2021

Copy link to clipboard

Copied

Hi Klaus,

how does

KLD_Z.FillDlgList (wPalC.lis1, asColours);

look like?

 

For tests just change

wPalC.lis1 = wPalC.add ("listbox", undefined, undefined);

to

wPalC.lis1 = wPalC.add ("listbox", undefined, [""]);

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
Enthusiast ,
Feb 10, 2021 Feb 10, 2021

Copy link to clipboard

Copied

Hi Klaus,

This is a long-standing ScriptUI bug. The only known work-around is to put the list box inside a Group or Panel containter.

The same bug afflicts the Tree View object too.

Ian

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 ,
Feb 10, 2021 Feb 10, 2021

Copy link to clipboard

Copied

LATEST

Thanks, Ian, to remind me...

Wherever it worked for me - and therefore I was so puzzled - actually is within a group together with a label at left (statictext) ...

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