Skip to main content
12-Amethyst
July 23, 2025
Question

Advanced Controls - List Box - selection not preserved

  • July 23, 2025
  • 2 replies
  • 1293 views

I noticed an issue with MCP11 vs 10 regarding Advanced Controls List Boxes where the selection is not preserved when a file is saved/closed/reopened. Anyone else seeing this issue?

Without selection preservation, List Boxes are basically useless. I haven't yet checked if the other types (checkboxes, radio buttons, etc.) maintain selection.

list box code (this worked in MCP10 w/o issue):

// TODO: Add your initialization code here
ListBox.ResetContent();
var list1 = Inputs[0].Value;
var list2 = Inputs[1].Value;

// Add Strings here as needed
for (var i = 0; i < list2.length; i++) {
ListBox.AddString(list2[i]);
}

function ListBoxEvent_Start(Inputs, Outputs) {
// TODO: Add your code here
};

function ListBoxEvent_Exec(Inputs, Outputs) {
Outputs[0].Value = list1[ListBox.CurSel()];
};

function ListBoxEvent_Stop(Inputs, Outputs) {
// TODO: Add your code here
};

function ListBox_SelChanged(Inputs, Outputs) {
// TODO: Add your code here
};

function ListBox_DblClick(Inputs, Outputs) {
// TODO: Add your code here
};

Andy_C_0-1753245409415.png

Andy_C_2-1753245600237.png

 

 

2 replies

DJNewman
18-Opal
July 23, 2025

So I'm comparing two test List Box examples (the JScript example in Help https://support.ptc.com/help/mathcad/r11.0/en/index.html#page/PTC_Mathcad_Help/example_listbox.html# ).

 

Mathcad Prime 10.0.1.0 retains the selection after saving and closing when you remove the ListBox.CurSel(0); from the example, which you did, wisely. That's all. You may have whatever option selected you want. This matches up with your experience.

 

Mathcad Prime 11.0.0.0 will only retain the selection after saving and closing when you both do that and you disable the "Run Advanced Control script on worksheet open"  option in PTC Mathcad Options. Do you have that option disabled?

PTC Marketer Creo and Mathcad. I run their YouTube channels, some Creo campaigns, and all Mathcad campaigns and communications.
Andy_C12-AmethystAuthor
12-Amethyst
July 23, 2025

Hi @DJNewman , 
Thanks for the reply.

So, I've been testing by saving and closing repeatedly as I've been trying to update my MCP10 scripts to get this to work, but haven't had any luck. Also, I first realized this issue when I opened a MCP10 file (w/ the working script) in 11 and all my list box selections were reset. So, the 10 file had already been saved and closed. And, yes, the "Run Advanced Control script on worksheet open" option has been disabled as a default (I've never used that one). What else do you think I am missing?

Andy_C_0-1753297055091.png

 

DJNewman
18-Opal
July 23, 2025

Without your worksheet (not just the script in the boxes but how the inputs are made too), I can't really take time to test things, but since I know you have access to opening a PTC Tech Support case, you should do that and send them your worksheet and they can help you out. And if it's a bug of some sort, then they'd be able to identify that as something to be fixed in the next version.

PTC Marketer Creo and Mathcad. I run their YouTube channels, some Creo campaigns, and all Mathcad campaigns and communications.
Andy_C12-AmethystAuthor
12-Amethyst
September 29, 2025

Update:

PTC has released 11.0.1.0 which partially fixes this issue. The previous v10 behavior has returned where Advanced Controls List Box selection is preserved. HOWEVER, there is one giant caveat: this only works when the ORIGIN is set to 0 (it does not work with ORIGIN = 1).

 

Users can assign ORIGIN to 0 above an AC and then reset it to 1 if they'd like, but the AC will only work the intended way with it set to 0. Example shown below.

 

Andy_C_0-1759178221673.png