cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

List Box Confusion

ptc-2603810
1-Newbie

List Box Confusion

I am a first time MathCad user and have a project due for a grad class. I can not figure out how to use a simple list box to select a text string in the box and assign a numerical variable as the output. I have read everything in the Developer's Reference Manual but nothing is basic enough for me. Please help!
5 REPLIES 5
RichardJ
19-Tanzanite
(To:ptc-2603810)

If you insert a listbox the default script does exactly that. Can you be more specific about what you don't understand, or are trying to do?

Richard

Thanks for responding! I would like to select a text string from the list box and assign a value to a variable. For example: if "stress relieved strand" is selected from the list box, I want to assign Yp=0.40; if "Low lax" is selected, I want to assign Yp=0.55.
RichardJ
19-Tanzanite
(To:ptc-2603810)

You can have as many ElseIf statements as required.

Richard

Follwing is the script that I have been messing with for a week and still no luck! I truly appreciate your help.

Rem Initialize List Box
ListBox.ResetContent()

Rem Add Strings here as needed
ListBox.AddString("Bars")
ListBox.AddString("Stress Relived")
ListBox.AddString("Low Lax")


ListBox.ResetContent()

ListBox.CurSel = 0
Sub ListBoxEvent_Start()
End Sub

Sub ListBoxEvent_Exec(Inputs,Outputs)

If ListBox.Cursel = 0 Then
Output_number = .55
ElseIf ListBox.Cursel = 1 Then
Output_number = .4
Else
Output_number = .25
EndIf

Outputs(0).value = output_number
End Sub

Sub ListBox_Dblclick(1)
ListBox.Recalculate()
End Sub

Hi.

Alvaro.
Top Tags