select the given button or value.
 This may be called by user programs to programmatically select a button
483045
def select button
      if button.is_a? String
        ;
      else
        button = button.value
      end
      set_value button
    end
987430
function (target, value, text) {
			var inst = this._getInst(target),
				onChange = this._get(inst, 'onChange');
			$("#sbSelector_" + inst.uid).text(text);
			$(target).find("option[value='" + value + "']").attr("selected", TRUE);
			if (onChange) {
				onChange.apply((inst.input ? inst.input[0] : null), [value, inst]);
			} else if (inst.input) {
				inst.input.trigger('change');
			}
		}
436345
def select(method, choices = nil, options = {}, html_options = {}, &block)
      choices = instance_exec(&choices) if choices.is_a?(Proc)
      super
    end
808906
def OnToggle(self, event):
        """"""

        if self.selection_toggle_button.GetValue():
            self.entry_line.last_selection = self.entry_line.GetSelection()
            self.entry_line.last_selection_string = \
                self.entry_line.GetStringSelection()
            self.entry_line.last_table = self.main_window.grid.current_table
            self.entry_line.Disable()
            post_command_event(self, self.EnterSelectionModeMsg)

        else:
            self.entry_line.Enable()
            post_command_event(self, self.GridActionTableSwitchMsg,
                               newtable=self.entry_line.last_table)
            post_command_event(self, self.ExitSelectionModeMsg)
935283
def button(value)
      # Don't use ele_index because that only works on one element type.
      # Android needs to combine button and image button to match iOS.
      if value.is_a? Numeric
        index = value
        raise "#{index} is not a valid index. Must be >= 1" if index <= 0

        # 1 indexed
        return find_element :uiautomator, _button_visible_selectors(index: index)
      end

      find_element :uiautomator, _button_contains_string(value)
    end
322957
def __buttonEvent(event=None, buttons=None, virtual_event=None):
    
    # TODO: Replace globals with tkinter variables
    global boxRoot, __replyButtonText

    # Determine window location and save to global
    m = re.match("(\d+)x(\d+)([-+]\d+)([-+]\d+)", boxRoot.geometry())
    if not m:
        raise ValueError(
            "failed to parse geometry string: {}".format(boxRoot.geometry()))
    width, height, xoffset, yoffset = [int(s) for s in m.groups()]
    st.rootWindowPosition = '{0:+g}{1:+g}'.format(xoffset, yoffset)

    # print('{0}:{1}:{2}'.format(event, buttons, virtual_event))
    if virtual_event == 'cancel':
        for button_name, button in list(buttons.items()):
            if 'cancel_choice' in button:
                __replyButtonText = button['original_text']
        __replyButtonText = None
        boxRoot.quit()
        return

    if virtual_event == 'select':
        text = event.widget.config('text')[-1]
        if not isinstance(text, ut.str):
            text = ' '.join(text)
        for button_name, button in list(buttons.items()):
            if button['clean_text'] == text:
                __replyButtonText = button['original_text']
                boxRoot.quit()
                return

    # Hotkeys
    if buttons:
        for button_name, button in list(buttons.items()):
            hotkey_pressed = event.keysym
            if event.keysym != event.char:  # A special character
                hotkey_pressed = '<{}>'.format(event.keysym)
            if button['hotkey'] == hotkey_pressed:
                __replyButtonText = button_name
                boxRoot.quit()
                return

    print("Event not understood")
1270098
def select_window_with_click(self):
        
        window_ret = window_t(0)
        _libxdo.xdo_select_window_with_click(
            self._xdo, ctypes.byref(window_ret))
        return window_ret.value
421379
def on_button_press(self, event):
        
        if event.get_button()[1] not in self._buttons:
            return False  # Only handle events for registered buttons (left mouse clicks)

        if event.get_state()[1] & constants.RUBBERBAND_MODIFIER:
            return False  # Mouse clicks with pressed shift key are handled in another tool

        # Special case: moving the NameView
        # This is only allowed, if the hovered item is a NameView and the Ctrl-key is pressed and the only selected
        # item is the parental StateView. In this case, the selection and _item will no longer be looked at,
        # but only _move_name_v
        self._item = self.get_item()
        if isinstance(self._item, NameView):
            selected_items = self.view.selected_items
            if event.get_state()[1] & Gdk.ModifierType.CONTROL_MASK and len(selected_items) == 1 and next(iter(selected_items)) is \
                    self._item.parent:
                self._move_name_v = True
            else:
                self._item = self._item.parent

        if not self._move_name_v:
            self._old_selection = self.view.selected_items
            if self._item not in self.view.selected_items:
                # When items are to be moved, a button-press should not cause any deselection.
                # However, the selection is stored, in case no move operation is performed.
                self.view.handle_new_selection(self._item)

        if not self.view.is_focus():
            self.view.grab_focus()

        return True
404089
@SuppressWarnings("unchecked")
    @Override
    public void setValue(Object value) throws WidgetException {
        try {
            if (value instanceof String) {
                selectSingle((String) value);
            } else if (value instanceof List<?>) {
                selectMultiple((List<String>) value);
            } else {
                throw new WidgetRuntimeException(
                        "Invalid type. 'value' must be either 'String' type of 'List<String>'.", getByLocator());
            }
        } catch (Exception e) {
            throw new WidgetException("Error while selecting option on select", getByLocator(), e);
        }
    }
501711
function createButton(opts) {
    opts = _.defaults(opts || {}, {
        // Aria label for the button
        label: '',

        // Icon to show
        icon: '',

        // Inner text
        text: '',

        // Right or left position
        position: 'left',

        // Other class name to add to the button
        className: '',

        // Triggered when user click on the button
        onClick: defaultOnClick,

        // Button is a dropdown
        dropdown: null,

        // Position in the toolbar
        index: null
    });

    buttons.push(opts);
    updateButton(opts);
}
642515
def is_pressed(self, button):
        """"""
        if button not in set((SELECT, RIGHT, DOWN, UP, LEFT)):
            raise ValueError('Unknown button, must be SELECT, RIGHT, DOWN, UP, or LEFT.')
        return self._mcp.get(button)
1040490
@Override
	public final void select(final String optionText) {
		if(optionText.contains("submit::")){
			String value = optionText.split("::")[1];
			select(Type.VALUE, value);
		}else {
			select(Type.TEXT, optionText);
		}
	}
575551
public final void mSELECT() throws RecognitionException {
		try {
			int _type = SELECT;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// hql.g:58:8: ( 'select' )
			// hql.g:58:10: 'select'
			{
			match("select"); if (state.failed) return;

			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}
991909
@Override
    public Object getValue() throws WidgetException {
        List<String> selectedOptions = null;
        try {
            selectedOptions = getSelectedItems_internal();

        } catch (Exception e) {
            throw new WidgetException("Error while fetching selected value on select",
                    getByLocator(), e);
        }

        if (selectedOptions.size() == 0) {
            return null;
        } else if (selectedOptions.size() == 1) {
            return selectedOptions.get(0);
        } else {
            return selectedOptions;
        }
    }
1047888
def OnButtonCell(self, event):
        """"""

        if self.button_cell_button_id == event.GetId():
            if event.IsChecked():
                label = self._get_button_label()
                post_command_event(self, self.ButtonCellMsg, text=label)
            else:
                post_command_event(self, self.ButtonCellMsg, text=False)

        event.Skip()
192746
def button_for_js(label, js, html_options={})
      tag(:input, {type: 'button', value: label, onClick: js}.merge(
        html_options))
    end
126317
def button_clicked(self, button):
        
        if button is self.idx_ok:

            #new_format = self.new_format.get_value().lower()
            new_format = 'edf'
            chan = None
            beg = None
            end = None

            if not self.all_time.get_value():
                beg = self.times['beg'].get_value()
                end = self.times['end'].get_value()

            if not self.all_chan.get_value():
                chan = self.get_channels()

            self.parent.info.export(new_format, filename=self.filename,
                                    chan=chan, begtime=beg, endtime=end)

            self.accept()

        if button is self.idx_cancel:
            self.reject()