Jump to content
Sign in to follow this  
VisSim Forum Archives

Fixed set of values as dropdown inputs

Recommended Posts

Submitted by vinayak on Thu, 01/21/2016 - 23:59 

I want to know if there is a way to input pre-selected values as inputs similar to drop down menus. Example> if I want to ensure user can input only one of the pre-selected values e.g., 0,25,50,75,100 , but no other values how can I do it? Secondly> if I want to name these values such as NONE, QUARTER, HALF etc. which when selected will input corresponding numeric value, how can I do this in a model? Thanks, Vinayak

Share this post


Link to post
Share on other sites

Submitted by pete on Fri, 01/22/2016 - 01:22.

You need to use dialogConstant blocks like this one: dialogConst.png . It is under Blocks > Signal Producers.
Right click the block to set it up as a dropdown (integer list):

dialogConst-properties.png

 

The output of the dialogConstant block will be the ordinal value of the selected item in the list.
The topmost item has value 0.
To transform the list index value to other values, use a case block as below:

 

dialogValMap.png

 

To see your dialogConstant dropdown along with other dialogConstants in a dialog box, encapsulate all the dialogConstants and associated blocks into a Compound block. Ctrl + right click on the Compound and select "Create Dialog from Contained Dialog Constants" as below:

 

dialogConst-CompoundProperties.png

 

When the user right clicks on the compound, The following custom dialog containing all dialogConstant blocks will appear. We added one more dialogConstant block for "Test Duration". See below:

 

RtClickToCustomDialog.png

 

If you are signed in, you can download the example diagram used for the above screen shots by clicking the attachment below.

dialogConstant test.vsm

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...