What's new

WizoScript select from list

NateLiquidGravity

Alibre Super User
Hello can anyone give me an example of a WizoScript options dialog allowing selection from a list? I see SetStringList in the reference docs but I don't understand how to use it.
 

oldfox

Alibre Super User
Nate, this is as the filename says, a WIP. REALLY! So it probably won't even run in it's present state. I think there is enough there for you
to get an idea. This is probably not the most elegant piece of coding but it does what I want it to do. (mostly)

There are more efficient ways within Python but I'm just learning Py. You may look at "lists" in python. Wizoscripts will take any valid
Python commands or structures. Good luck.

ps. You will have to change the extension back to a .py extension to run it. Just use a word processor for creating this. Cut and paste into
WizoScript, or build it within WS if you desire. WS will "save" it into a .py file.

"ajayre" in the forum is the WizoScript wizard.
 

Attachments

  • My Screws WIP - 2.txt
    10.4 KB · Views: 10

oldfox

Alibre Super User
Nate, you can run this one. It works. Just copy the code and paste into WS as a new script.
 

Attachments

  • My Screws.txt
    4.4 KB · Views: 4

oldfox

Alibre Super User
The drop down list can probably be added in the script using Py code. That is above my pay grade. Andy would be the the most likely forum member to help you with that. If you were doing it the same way as I, then that may indicate that we think alike. And that is SCARY!!! :rolleyes: :D
 

ajayre

Alibre Super User
Here is an example:

Code:
# called when an input changes in the dialog window
def InputChanged(Index, Value):
  # size changed
  if Index == 0:
    Size = DiameterNames[Value]
    print Size

# called when user confirms selections
def SelectionMade(Values):
  # get values
  Size = DiameterNames[Values[0]]
  print Size

# get access to windows functionality
Win = Windows()

# default diameter to show
DefaultDiameter = 'M6'

# list of diameters to choose from
DiameterNames = ['M6', 'M8', 'M10', 'M12']

# create dialog window
Options = []
Options.append(['Size', WindowsInputTypes.StringList, DiameterNames, DefaultDiameter])

# show dialog window to user
DialogWidth = 400
Win.UtilityDialog('Test', 'Apply', SelectionMade, InputChanged, Options, DialogWidth)

Andy
 
Last edited:
Top