Dynamic Listbox save state Mathcad Prime 10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Dynamic Listbox save state Mathcad Prime 10
I am attempting to generate a list box from a vector within the worksheet. The next step would be to populate the vector from Excel data. In the attached file, I'm able to create the list box, but the issue is the selection is not kept after saving, closing, and re-opening. When the worksheet is first opened for a brief second, test equals the value from when the file was closed, but it quickly changes to the first item in the listbox. Within the attached worksheet are two other list boxes. One is un-edited after inserting it from the menu. The second only has a few text modifications. Both are keeping the selected value after re-opening.
Changing these options did not make a difference.
Here is the code to generate the list box:
// TODO: Add your initialization code here
function ListBoxEvent_Start(Inputs, Outputs) {
};
function ListBoxEvent_Exec(Inputs, Outputs) {
var test_options = Inputs[0].Value;
// Reset ListBox content and add new items
ListBox.ResetContent()
for(var i=0; i < test_options.length; i++){
ListBox.AddString(test_options[i]);
}
// Set output values based on selection
//Outputs[0].Value = test_options[ListBox.CurSel()];
Outputs[0].Value = ListBox.CurSel() + 1;
};
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
};
Any recommendations?
Thank you in advance!