Skip to main content
K.Daube
Community Expert
Community Expert
April 10, 2021
Answered

Dialogue with list box: listbox stays empty although there is a group defined

  • April 10, 2021
  • 1 reply
  • 180 views

Dear friends, I need your sharp eyes!

I have two - IMHO identical - functions to set up a dialogue with list box. One works, one presents the listbox empty...

What is wrong here?

 

 

// Test_DebugMenu.jsx ====== UTF-8 ========================================

var KLD_Z = KLD_Z || {};                          // global script object

KLD_Z.ThisWorks = function () { // ========================================
var asColours = ["black", "blue", "brown", "green", "mauve", "red", "violet", "white"], wPalC;
	wPalC = new Window("dialog", "Colours in this document", undefined); 
	wPalC.g1   = wPalC.add ("group", undefined, undefined); 
	wPalC.g1.lis1 = wPalC.g1.add ("listbox", undefined, asColours);
	wPalC.g1.lis1.preferredSize.width = 200; 
	wPalC.g1.lis1.preferredSize.height = 100; 
  wPalC.show();} //--- end ThisWorks --------------------------------------

KLD_Z.DebugMenu = function () { //=== Invoke individul menu items =========
var aMenuItems, wDlgD;
  aMenuItems = ["Fgr_OpenHelpFile",  "Fgr_IdentifyObject", "Fgr_AssignProperties"];
  wDlgD = new Window("dialog", "Test Debug menu", undefined);
	wDlgD.g1 = wDlgD.add ("group", undefined, undefined);
  	wDlgD.g1.lis1 = wDlgD.add ("listbox", undefined, aMenuItems);
	  wDlgD.g1.lis1.preferredSize.width = 200; 
	  wDlgD.g1.lis1.preferredSize.height = 100; 
  wDlgD.show();
} //--- end DebugMenu -----------------------------------------------------

  KLD_Z.ThisWorks ();
  KLD_Z.DebugMenu ();

 

 

This topic has been closed for replies.
Correct answer K.Daube

Well, after lunch pause with coffie I found the problem:

wDlgD.g1.lis1 = wDlgD.g1.add ("listbox", undefined, aMenuItems);

The reference to the group was missing...

1 reply

K.Daube
Community Expert
K.DaubeCommunity ExpertAuthorCorrect answer
Community Expert
April 10, 2021

Well, after lunch pause with coffie I found the problem:

wDlgD.g1.lis1 = wDlgD.g1.add ("listbox", undefined, aMenuItems);

The reference to the group was missing...