Constructor

@param KeyboardButton[][] $keyboard
@param bool $resize_keyboard
@param bool $one_time_keyboard
@param bool $selective
@return static
503070
public static function create(
        $keyboard,
        $resize_keyboard = false,
        $one_time_keyboard = false,
        $selective = false
    ) {
        return static::build(compact(
            'keyboard',
            'resize_keyboard',
            'one_time_keyboard',
            'selective'
        ));
    }
19172
protected function callSelector($key)
    {
        foreach ($this->selectors as $selector => $callback) {
            $regex = '/' . $selector . '/i';
            if (preg_match($regex, $key, $matches)) {
                return call_user_func_array($callback, array($this, $key, $matches));
            }
        }

        throw new Exception\Index('Unknown index: ' . $key);
    }
660928
public function select(String $name = NULL, Array $options = [], $selected = NULL, Array $_attributes = [], Bool $multiple = false)
    {
        $this->isTableOrQueryData($options);

        $this->setOptionAttribute($options);

        $this->isExcludeAttribute($options);

        $this->isIncludeAttribute($options);

        $this->isOrderAttribute($options);

        $this->setSelectedAttribute($selected, $options);

        $this->setMultipleAttribute($multiple, $_attributes);

        $this->setNameAttributeWithReference($name, $_attributes);

        if( ! empty($_attributes['name']) )
        {
            $this->_postback($_attributes['name'], $selected);

            # 5.8.2.8[added]
            $this->getVMethodMessages();

            # 5.4.2[added]
            $this->_validate($_attributes['name'], $_attributes['name']);
            
            # 5.4.2[added]|5.4.5|5.4.6[edited]
            $selected = $this->_getrow('select', $selected, $_attributes);
        }

        $this->commonMethodsForInputElements('select');

        $this->getPermAttribute($perm);

        $this->createSelectElement($options, $selected, $_attributes, $return);

        $this->createBootstrapFormInputElementByType('select', $return, $_attributes, $return);

        $this->_unsetselect();

        $this->outputElement .= $this->_perm($perm, $return);

        return $this;
    }
701147
public function multiselect(String $name = NULL, Array $options = [], $selected = NULL, Array $_attributes = [])
    {
        return $this->select($name, $options, $selected, $_attributes, true);
    }
870463
function (keyboardProxy, pos) {
    var el = keyboardProxy[0];
    if (el.setSelectionRange) {
      el.focus();
      el.setSelectionRange(pos, pos);
    }
    else if (el.createTextRange) {
      var range = el.createTextRange();
      range.collapse(true);
      range.moveEnd('character', pos);
      range.moveStart('character', pos);
      range.select();
    }
  }
1033125
public function bind($channel_ref, $affinity_key)
    {
        if (!array_key_exists($affinity_key, $this->affinity_key_to_channel_ref)) {
            $this->affinity_key_to_channel_ref[$affinity_key] = $channel_ref;
        }
        $channel_ref->affinityRefIncr();
        return $channel_ref;
    }
1224388
public function getArray(bool $clean_keyboard = true) : array
    {
        if (empty($this->inline_keyboard)) {
            throw new BotException("Inline keyboard is empty");
        }

        // Create a new array to put the buttons
        $reply_markup = ['inline_keyboard' => $this->inline_keyboard];

        if ($clean_keyboard) {
            $this->clearKeyboard();
        }

        return $reply_markup;
    }
829699
protected function createSelectElement($options, $selected, $_attributes, &$return)
    {
        $return = '<select'.$this->attributes($_attributes).'>';

        if( is_array($options) ) foreach( $options as $key => $value )
        {
            if( is_array($selected) )
            {
                if( in_array($key, $selected) )
                {
                    $select = ' selected="selected"';
                }
                else
                {
                    $select = "";
                }
            }
            else
            {
                if( $selected == $key )
                {
                    $select = ' selected="selected"';
                }
                else
                {
                    $select = "";
                }
            }

            $return .= '<option value="'.$key.'"'.$select.'>'.$value.'</option>'.EOL;
        }

        $return .= '</select>'.EOL;
    }
767946
def handle_keys
      @selected = false
      @repaint_required = true # added 2011-12-12 otherwise keeps repainting and you see a flicker
      @toggle_key ||= 27 # default switch off with ESC, if nothing else defined
      set_menu 0
      begin
      catch(:menubarclose) do
      while((ch = @window.getchar()) != @toggle_key )
       #$log.debug "menuubar inside handle_keys :  #{ch}"  if ch != -1
        case ch
        when -1
          next
        when KEY_DOWN
    
          if !@selected
            current_menu.fire
          else
            current_menu.handle_key ch
          end
            
          @selected = true
        when KEY_ENTER, 10, 13, 32
          @selected = true
          ret = current_menu.handle_key ch
          #break; ## 2008-12-29 18:00  This will close after firing anything
          break if ret == :CLOSE
        when KEY_UP
          current_menu.handle_key ch
        when KEY_LEFT
          ret = current_menu.handle_key ch
          prev_menu if ret == :UNHANDLED
        when KEY_RIGHT
          ret = current_menu.handle_key ch
          next_menu if ret == :UNHANDLED
        when ?\C-g.getbyte(0) # abort
          throw :menubarclose
        else
          ret = current_menu.handle_key ch
          if ret == :UNHANDLED
            Ncurses.beep 
          else
            break  # we handled a menu action, close menubar (THIS WORKS FOR MNEMONICS ONLY and always)
          end
        end
        Ncurses::Panel.update_panels();
        Ncurses.doupdate();

        @window.wrefresh
      end
      end # catch
      ensure
        #ensure is required becos one can throw a :close
        $log.debug " DESTROY IN ENSURE"
        current_menu.clear_menus
        @repaint_required = false
        destroy  # Note that we destroy the menu bar upon exit
      end
    end
306349
function createKeyboardEvent(type, options) {
  options = clean(type, options);
  var e = document.createEvent('KeyboardEvent');
  (e.initKeyEvent || e.initKeyboardEvent).call(
    e,
    type,
    options.bubbles,
    options.cancelable,
    options.view,
    options.ctrl,
    options.alt,
    options.shift,
    options.meta,
    options.key,
    options.key
  );

  // http://stackoverflow.com/a/10520017
  if (e.keyCode !== options.key) {
    Object.defineProperty(e, 'keyCode', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'charCode', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'which', {
      get: function() { return options.key; }
    });
    Object.defineProperty(e, 'shiftKey', {
      get: function() { return options.shift; }
    });
  }

  return e;
}
819138
public function create($formType, InputInterface $input, array $options = [])
    {
        $options = $this->addDefaultOptions($options);

        $formBuilder = $this->formFactory->createBuilder(FormUtil::formTypeToString($formType), null, $options);

        foreach ($formBuilder as $name => $childBuilder) {
            /* @var FormBuilderInterface $childBuilder */
            if (!$input->hasOption($name)) {
                continue;
            }

            $providedValue = $input->getOption($name);
            if ($providedValue === null) {
                continue;
            }

            $childBuilder->setData($providedValue);
        }

        return $formBuilder->getForm();
    }
981649
def to_array(self):
        
        array = super(ReplyKeyboardRemove, self).to_array()
        array['remove_keyboard'] = bool(self.remove_keyboard)  # type bool
        if self.selective is not None:
            array['selective'] = bool(self.selective)  # type bool
        return array
523412
private void addKeyboardListener(KeyboardAwt keyboard)
    {
        componentForKeyboard.addKeyListener(keyboard);
        componentForKeyboard.requestFocus();
        componentForKeyboard.setFocusTraversalKeysEnabled(false);
    }
1065921
public function choose($string, array $choices, $useChoiceKeysAsSelector = true) {
        $this->output->writeLine("<question>$string</question>");

        $choicesMap = [];

        foreach ($choices as $subject => $message) {
            if ($useChoiceKeysAsSelector) {
                $index = $subject;
            } else {
                $index = count($choicesMap) + 1;
            }

            $choicesMap[$index] = [
                'subject' => $subject,
                'message' => $message,
            ];
        }

        foreach ($choicesMap as $index => $choice) {
            $message = array_get($choice, 'message');

            $this->output->writeLineIndented("[<yellow>$index</yellow>] $message");
        }

        $choice = null;

        while (true) {
            $this->output->writeIndented('Choice: ');
            $input = $this->input->readLine();

            if (array_has($choicesMap, $input)) {
                $choice = array_get(array_get($choicesMap, $input), 'subject');
                break;
            }

            if ( ! empty($input)) {
                $this->output->writeLineIndented('<yellow>Invalid choice</yellow>');
            }
        }

        return $choice;
    }
737348
public function scopeFiltersApplySelection(Builder $query, $selection)
    {
        if (! is_object($selection)) {
            $selection = app()->make($selection);
        }

        $filters = $selection->filters();

        return $this->scopeFiltersApply($query, $filters);
    }
85122
protected function _createGroup($key, array $gOptions, array $selected, array $options)
    {
        $label  = (is_int($key)) ? sprintf($this->_translate('Select group %s'), $key) : $key;
        $output = array(
            '<optgroup label="' . $this->_translate($label) . '">'
        );
        foreach ($gOptions as $value => $label) {
            if (Arr::key($value, $options)) {
                continue;
            }

            $classes = implode(' ', array(
                $this->_jbSrt('option'),
                $this->_jbSrt('option-' . Str::slug($label)),
            ));

            $isSelected = $this->_isSelected($value, $selected);

            $output[] = $this->_option($value, $isSelected, $classes, $label);
        }

        $output[] = '</optgroup>';

        return implode(PHP_EOL, $output);
    }
1052805
public function resize($width, $height = NULL, $resizeMode = NULL)
    {
        if(!$height)
        {
            $height = $width;
        }

        $this->effect[] = new Resize($width, $height, $resizeMode);
    }