Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Translate the entire conversation x

Mathcad prime 10. Advanced Controls. List. Writing a script on JS

panzerbaha
4-Participant

Mathcad prime 10. Advanced Controls. List. Writing a script on JS

I have an array (numbers of rows - 1,  number of columns - can be different). Example: I enter a variable in mathcad d = [1 5 10 15] and i want this array to be displayed in my list as d = 1   d= 5 etc... Help please. Preferably in JS. Translated using Google Translate.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:panzerbaha)

> i want this array to be displayed in my list as d = 1

 

Which list? And where? An external text file?

Please specify more precisely and if possible give one or two examples to show what you are looking for.

 

Ahh, you shouldn't hide important informations just in the thread subject!

In case you are looking for a vector to be the input for the items of a list box, you will find some examples here in the forum - some more , some less sophisticated.

 

A simple one is attached - hope it helps

Werner_E_0-1741928104322.png

 

// TODO: Add your initialization code here
// Initialize Selection If desired
ListBox.CurSel(0);

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

function ListBoxEvent_Exec(Inputs, Outputs) {
	var options = Inputs[0].Value;

	ListBox.ResetContent()
	for(var i=0; i < options.length; i++) {
	ListBox.AddString(options[i]);
	}

	Outputs[0].Value = options[ListBox.CurSel()];
};

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

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

 

 

View solution in original post

4 REPLIES 4
ppal
17-Peridot
(To:panzerbaha)

Like this?  

ppal_1-1741925420206.png

 

Werner_E
25-Diamond I
(To:panzerbaha)

> i want this array to be displayed in my list as d = 1

 

Which list? And where? An external text file?

Please specify more precisely and if possible give one or two examples to show what you are looking for.

 

Ahh, you shouldn't hide important informations just in the thread subject!

In case you are looking for a vector to be the input for the items of a list box, you will find some examples here in the forum - some more , some less sophisticated.

 

A simple one is attached - hope it helps

Werner_E_0-1741928104322.png

 

// TODO: Add your initialization code here
// Initialize Selection If desired
ListBox.CurSel(0);

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

function ListBoxEvent_Exec(Inputs, Outputs) {
	var options = Inputs[0].Value;

	ListBox.ResetContent()
	for(var i=0; i < options.length; i++) {
	ListBox.AddString(options[i]);
	}

	Outputs[0].Value = options[ListBox.CurSel()];
};

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

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

 

 

panzerbaha
4-Participant
(To:Werner_E)

This is exactly what i wanted, thank you

Werner_E
25-Diamond I
(To:panzerbaha)


@panzerbaha wrote:

This is exactly what i wanted, thank you


Glad you got what you needed.

So you may consider closing the thread unless there are additional related questions.

Announcements

Top Tags