BookmarkSubscribeSubscribe to RSS Feed

How can I create a dynamic behavior in a list box depending on a combo box?

j_angel_ramos_m

Community Trekker

Joined:

Nov 10, 2015

Hi,

I want to update a list box dynamically depending on the value in a combo Box, how can I do that? I am using a mouse box as enabler.

I am trying with the following code:

  

vtotal_mi1 = {"b", "a", "pi"};
vtotal_mi2 = {"b2", "a2", "pi2"};
vtotal_mi3 = {"b3", "a3", "pi3"};
 
clusterDlg = New Window( "==*== Test ==*==",
	V List Box(
		MouseBox(
			comboObj = Combo Box( {"All", "Timing", "Voltage"} ),
			<<setTrack( (comboObj << parent) << setMarkEnable( 1 ) ), 
  //<<setTrackEnable( 1 ),
 			<<getMarked(
				Function( {this, clickPt},
					x = comboObj << getSelected;
					If( x == "Timing",
						methodObj << Set items( vtotal_mi2 ),
						If( x == "Voltage",
							methodObj << Set items( vtotal_mi3 ),
							methodObj << Set items( vtotal_mi1 )
						)
					);
				)
			)
		),
		Panel Box( "Method", methodObj = List Box( vtotal_mi ) )
	)
);

With no success.

2 REPLIES
ms

Super User

Joined:

Jun 23, 2011

Consider a script in the ComboBox instead of a MouseBox. For example:

vtotal_mi = {{"b", "a", "pi"}, {"b2", "a2", "pi2"}, {"b3", "a3", "pi3"}};

 

clusterDlg = New Window("==*== Test ==*==",

    V List Box(

        comboObj = Combo Box(

            {"All", "Timing", "Voltage"},

            methodObj << set items(vtotal_mi[comboObj << get])

        ),

        Panel Box("Method", methodObj = List Box(vtotal_mi[1]))

    )

);

j_angel_ramos_m

Community Trekker

Joined:

Nov 10, 2015

Excellent, thank you