add a choice input line
167761
def add_choice(self, setting, choices):
        ''''''
        tab = self.panel(setting.tab)
        default = setting.value
        if default is None:
            default = choices[0]
        ctrl = wx.ComboBox(tab, -1, choices=choices,
                           value = str(default),
                           style = wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT )
        self._add_input(setting, ctrl)
809511
def add_options(self):
        
        # These options need to be conflict-free to the containing
        # script, i.e. avoid short options if possible.
        self.script.add_bool_option("-i", "--interactive",
            help="interactive mode (prompt before changing things)")
        self.script.add_bool_option("--yes",
            help="positively answer all prompts (e.g. --delete --yes)")
265918
def user_choice(prompt, choices=("yes", "no"), default=None):
    
    assert default is None or default in choices
    choice_list = ', '.join((choice.title() if choice == default else choice for choice in choices))
    response = None
    while response not in choices:
        response = input(prompt + ' [' + choice_list + ']: ')
        response = response.lower() if response else default
    return response
688893
def edit_choice(self, choice_id, text, inline_region, name=''):
        """"""
        if inline_region not in self.my_osid_object_form._my_map['choices']:
            raise IllegalState('that inline region does not exist')
        for choice in self.my_osid_object_form._my_map['choices'][inline_region]:
            if choice['id'] == choice_id:
                if choice['text'] != text:
                    choice['text'] = text
                if choice['name'] != name and name != '':
                    choice['name'] = name
                break
541255
def yn_choice(msg, indent=4, fg_color='cyan', separator=''):
    
    _header, _footer = gen_separator(separator=separator)
    if _header:
        textui.puts(getattr(textui.colored, fg_color)(_header))
    with textui.indent(indent, quote=' {}'.format(' ')):
        textui.puts(textui.colored.green(msg))
    if _footer:
        textui.puts(getattr(textui.colored, fg_color)(_footer))

    c = click.confirm(
        click.style('Your Choice?[yn] (q-quit/b-back)?', fg='cyan'),
        default=True,
    )
    return c
232777
def add_option(flag, text, scope=nil)
      scope or scope = 'Options'
      @options[scope] ||= {}
      @options[scope][flag] = text
    end
909307
function(_input,_clazz){
		        var _id = _e._$id(_input),
		            _label = _e._$wrapInline(_input,{
		                tag:'label',
		                clazz:_clazz,
		                nid:_ropt.nid
		            });
		        _label.htmlFor = _id;
		        var _text = _e._$attr(_input,'placeholder')||'';
		        _label.innerText = _text=='null'?'':_text;
		        var _height = _input.offsetHeight+'px';
		        _e._$style(_label,{
		            left:0,
		            // width:_input.offsetWidth+'px',
		            // height:_height,lineHeight:_height,
		            display:!_input.value?'':'none'
		        });
		    }
615471
function addOption( combo, optionText, optionValue, documentObject, index )
	{
		combo = getSelect( combo );
		var oOption;
		if ( documentObject )
			oOption = documentObject.createElement( "OPTION" );
		else
			oOption = document.createElement( "OPTION" );

		if ( combo && oOption && oOption.getName() == 'option' )
		{
			if ( CKEDITOR.env.ie ) {
				if ( !isNaN( parseInt( index, 10) ) )
					combo.$.options.add( oOption.$, index );
				else
					combo.$.options.add( oOption.$ );

				oOption.$.innerHTML = optionText.length > 0 ? optionText : '';
				oOption.$.value     = optionValue;
			}
			else
			{
				if ( index !== null && index < combo.getChildCount() )
					combo.getChild( index < 0 ? 0 : index ).insertBeforeMe( oOption );
				else
					combo.append( oOption );

				oOption.setText( optionText.length > 0 ? optionText : '' );
				oOption.setValue( optionValue );
			}
		}
		else
			return false;

		return oOption;
	}
977917
def choicebox(message='Pick something.', title='', choices=['program logic error - no choices specified']):
    
    return psidialogs.choice(message=message, title=title, choices=choices)
847205
function () {
			
			var choices, length, i, sep;
			
			this.choicesList = [];
			
			choices = this.options.choices;
			
			for (i = 0, length = choices.length ; i < length ; i += 1 ) {
				
				this.addChoice(choices[i]);
				
			}
			
			// Build a "any" radio combined with a StringField
			if (this.options.allowAny) {
				
				this.allowAnyChoice = this.addChoice({ value: this.options.allowAny.value, label:'' });
				
				this.radioAny = this.allowAnyChoice.node.firstChild;
				
				this.anyField = new inputEx(this.options.allowAny.field);
				this.anyField.disable();
				
				Dom.setStyle(this.radioAny, "float","left");
				Dom.setStyle(this.anyField.getEl(), "float","left");
				
				// Hack for firefox 3.5+
				if (YAHOO.env.ua.gecko >= 1.91) { Dom.setStyle(this.radioAny, "marginTop","0.2em"); }
				
				
				if (this.options.allowAny.separators) {
					sep = inputEx.cn("div",null,{marginRight:"3px"},this.options.allowAny.separators[0] || '');
					Dom.setStyle(sep, "float","left");
					this.allowAnyChoice.node.appendChild(sep);
				}
				
				this.allowAnyChoice.node.appendChild(this.anyField.getEl());
				
				if (this.options.allowAny.separators) {
					sep = inputEx.cn("div",null,{marginLeft:"3px"},this.options.allowAny.separators[1] || '');
					Dom.setStyle(sep, "float","left");
					this.allowAnyChoice.node.appendChild(sep);
				}
				
			}
			
		}
920295
def draw_choices(bootstrap, type, method, collection, value_method, text_method, _options, html_options)
      draw_form_group_fieldset(bootstrap, method) do
        if bootstrap.custom_control
          label_css_class = "custom-control-label"

          form_check_css_class = "custom-control"
          form_check_css_class +=
            case type
            when :radio_button then " custom-radio"
            when :check_box    then " custom-checkbox"
            end

          form_check_css_class += " custom-control-inline" if bootstrap.check_inline

          add_css_class!(html_options, "custom-control-input")

        else
          label_css_class = "form-check-label"

          form_check_css_class = "form-check"
          form_check_css_class += " form-check-inline" if bootstrap.check_inline

          add_css_class!(html_options, "form-check-input")
        end

        errors    = draw_errors(method)
        help_text = draw_help(bootstrap.help)

        add_css_class!(html_options, "is-invalid") if errors.present?

        content = "".html_safe
        collection.each_with_index do |item, index|
          item_value  = item.send(value_method)
          item_text   = item.send(text_method)

          content << content_tag(:div, class: form_check_css_class) do
            concat yield method, item_value, html_options
            concat label(method, item_text, value: item_value, class: label_css_class)
            if ((collection.count - 1) == index) && !bootstrap.check_inline
              concat errors     if errors.present?
              concat help_text  if help_text.present?
            end
          end
        end

        if bootstrap.check_inline
          content << errors     if errors.present?
          content << help_text  if help_text.present?
        end

        content
      end
    end
1334982
private void inputOption(String optionId)
            throws InstallationCancelledException {

        OptionDefinition opt = OptionDefinition.get(optionId, this);

        if (opt.getLabel() == null || opt.getLabel().length() == 0) {
            throw new InstallationCancelledException(optionId
                    + " is missing label (check OptionDefinition.properties?)");
        }
        System.out.println(opt.getLabel());
        System.out.println(dashes(opt.getLabel().length()));
        System.out.println(opt.getDescription());

        System.out.println();

        String[] valids = opt.getValidValues();
        if (valids != null) {
            System.out.print("Options : ");
            for (int i = 0; i < valids.length; i++) {
                if (i > 0) {
                    System.out.print(", ");
                }
                System.out.print(valids[i]);
            }
            System.out.println();
        }

        String defaultVal = opt.getDefaultValue();
        if (valids != null || defaultVal != null) {
            System.out.println();
        }

        boolean gotValidValue = false;

        while (!gotValidValue) {

            System.out.print("Enter a value ");
            if (defaultVal != null) {
                System.out.print("[default is " + defaultVal + "] ");
            }
            System.out.print("==> ");

            String value = readLine().trim();
            if (value.length() == 0 && defaultVal != null) {
                value = defaultVal;
            }
            System.out.println();
            if (value.equalsIgnoreCase("cancel")) {
                throw new InstallationCancelledException("Cancelled by user.");
            }

            try {
                opt.validateValue(value);
                gotValidValue = true;
                _map.put(optionId, value);
                System.out.println();
            } catch (OptionValidationException e) {
                System.out.println("Error: " + e.getMessage());
            }
        }
    }
97653
function(option, inputValue) {
		var optVal = option.value.toLowerCase(),
			inptVal = inputValue.toLowerCase(),
			label = option.getAttribute('label'),
			text = option.text.toLowerCase();

		/*
		"Each option element that is a descendant of the datalist element, that is not disabled, and whose value is a string that isn't the empty string, represents a suggestion. Each suggestion has a value and a label."
		"If appropriate, the user agent should use the suggestion's label and value to identify the suggestion to the user."
		*/
		return Boolean(
			option.disabled === false &&
				((optVal !== '' && optVal.indexOf(inptVal) !== -1) ||
					(label && label.toLowerCase().indexOf(inptVal) !== -1) ||
					(text !== '' && text.indexOf(inptVal) !== -1))
		);
	}
640950
def input_option(message, options="yn", error_message=None):
    
    def _valid(character):
        if character not in options:
            print(error_message % character)
    return input("%s [%s]" % (message, options), _valid, True, lambda a: a.lower())
976096
def _setChoiceDict(self):
        """"""
        # value is full name of choice parameter
        self.choiceDict = minmatch.MinMatchDict()
        for c in self.choice: self.choiceDict.add(c, c)
340172
def select(message="", title="Lackey Input", options=None, default=None):
    
    if options is None or len(options) == 0:
        return ""
    if default is None:
        default = options[0]
    if default not in options:
        raise ValueError("<<default>> not in options[]")
    root = tk.Tk()
    input_text = tk.StringVar()
    input_text.set(message)
    PopupList(root, message, title, options, default, input_text)
    root.focus_force()
    root.mainloop()
    return str(input_text.get())
566035
function renderChoice( pointer ) {
  var output = "";

  this.choices.forEach(function( choice, i ) {
    output += "\n  ";

    if ( choice.type === "separator" ) {
      output += " " + choice;
      return;
    }

    var choiceStr = choice.key + ") " + choice.name;
    if ( pointer === choice.key ) {
      choiceStr = chalk.cyan( choiceStr );
    }
    output += choiceStr;
  }.bind(this));

  return output;
}