PressEquip
Civil/Environmental
- Oct 26, 2009
- 35
Hello,
I'm not very experienced with MathCad15 or programming. I'm looking for advice and resources on using Listbox and VBscript.
In MathCad I created a Matrix and propagated it with values.
I then created a ListBox. I want to edit the script of the list box so that the ListBox shows the first column of my matrix for possible selections. The ListBox will Output will be the matrix index of the selected item (click on the list box, select one of the options, MathCad variable will be assigned that value).
I'm having troubling figuring out the following
How to pass the MathCad Matrix into the VBscript, if I write click on the List Box, it shows options such as "Add input variable". What types of data can be entered (integer, floating point, alphanumeric strings, ...)?
How to create a Matrix in VBscript [I can create an array, code: Dim array(#,#,#,...)]
How to pass the index number out of the VBscript? if I write click on the List Box, it shows options such as "Add output variable". What types of data can be entered (integer, floating point, alphanumeric strings, ...)?
There are several sections to the VBscript in the List Box, as follows (What does each routine or sub-routine do?):
Rem Initialize List Box
ListBox.ResetContent()
Rem Add Strings here as needed
ListBox.AddString(1)
ListBox.AddString(2)
ListBox.AddString(3)
Rem Initialize Selection If desired
ListBox.CurSel = 0
Sub ListBoxEvent_Start()
End Sub
Sub ListBoxEvent_Exec(Inputs,Outputs)
Outputs(0).Value = ListBox.CurSel + 1
End Sub
Sub ListBoxEvent_Stop()
Rem TODO: Add your code here
End Sub
Sub ListBox_SelChanged()
ListBox.Recalculate()
End Sub
Sub ListBox_DblClick()
ListBox.Recalculate()
End Sub
Thank you in advance for any help you might be able to provide
A Fan of EngTips, share the knowledge
I'm not very experienced with MathCad15 or programming. I'm looking for advice and resources on using Listbox and VBscript.
In MathCad I created a Matrix and propagated it with values.
I then created a ListBox. I want to edit the script of the list box so that the ListBox shows the first column of my matrix for possible selections. The ListBox will Output will be the matrix index of the selected item (click on the list box, select one of the options, MathCad variable will be assigned that value).
I'm having troubling figuring out the following
How to pass the MathCad Matrix into the VBscript, if I write click on the List Box, it shows options such as "Add input variable". What types of data can be entered (integer, floating point, alphanumeric strings, ...)?
How to create a Matrix in VBscript [I can create an array, code: Dim array(#,#,#,...)]
How to pass the index number out of the VBscript? if I write click on the List Box, it shows options such as "Add output variable". What types of data can be entered (integer, floating point, alphanumeric strings, ...)?
There are several sections to the VBscript in the List Box, as follows (What does each routine or sub-routine do?):
Rem Initialize List Box
ListBox.ResetContent()
Rem Add Strings here as needed
ListBox.AddString(1)
ListBox.AddString(2)
ListBox.AddString(3)
Rem Initialize Selection If desired
ListBox.CurSel = 0
Sub ListBoxEvent_Start()
End Sub
Sub ListBoxEvent_Exec(Inputs,Outputs)
Outputs(0).Value = ListBox.CurSel + 1
End Sub
Sub ListBoxEvent_Stop()
Rem TODO: Add your code here
End Sub
Sub ListBox_SelChanged()
ListBox.Recalculate()
End Sub
Sub ListBox_DblClick()
ListBox.Recalculate()
End Sub
Thank you in advance for any help you might be able to provide
A Fan of EngTips, share the knowledge