GetOption - all options shown at once

Having a small brain fart here… I want to be able to choose from a list of options. I have this in my code snippets:

import Rhino

def CommandLineOptions(prompt,msg,choices,ini):
    go = Rhino.Input.Custom.GetOption()
    go.SetCommandPrompt(prompt)
    
    lstOption0 = go.AddOptionList(msg,choices,ini)
    
    go.AcceptNothing(True)
    index=ini
    while True:
        get_rc = go.Get()
        if go.CommandResult()== Rhino.Commands.Result.Cancel:
            return
        elif go.CommandResult()== Rhino.Commands.Result.Nothing:
            break
        elif get_rc==Rhino.Input.GetResult.Option:
            if go.OptionIndex()==lstOption0:
                index = go.Option().CurrentListOptionIndex
            continue
        break
    return index
    
#Test
prompt="These are your options:"
msg="Option"
ini=0
choices=["A","B","C","D","E"]
opt=CommandLineOptions(prompt,msg,choices,ini)
if opt is not None: print "You chose option {}".format(choices[opt])

This works fine, but when I run the script I am first presented with this:
image

What I would like to see first is this (what I get when I click on ‘Option=A’):
image

I don’t remember how to do this…

Thanks, --Mitch

Hi Mitch - I think just AddOption() five times, one for each.
Wait that does not get you the default… hold on, I thnk I did this recently.

go.SetCommandPromptDefault("A") 
go.AcceptNothing(True)

might help.

@Helvetosaur - I ran into this again, and, well, I don’t say it’s elegant or the best way but this did seem to work

modes = ['A', 'B', 'C']

while True:
    opIdx = 0

    if sc.sticky.has_key('OPTION_IDX'):
                opIdx = sc.sticky['OPTION_IDX']

           gp = Rhino.Input.Custom.GetPoint()
        
           gp.AddOption("A")
           gp.AddOption("B")
           gp.AddOption("C")

           gp.AcceptNothing(True)
           gp.SetDefaultString(modes[opIdx-1])

           rc = gp.Get()

etc etc

        elif rc == Rhino.Input.GetResult.Option or rc == Rhino.Input.GetResult.String:
            if rc == Rhino.Input.GetResult.String:
                idx = opIdx
            else:
                idx = gp.OptionIndex()

See what I mean?

-Pascal