button:  sets text, checking for ampersand, uses that for hotkey and underlines
343217
def text(*val)
      if val.empty?
        return @text
      else
        s = val[0].dup
        s = s.to_s if !s.is_a? String  # 2009-01-15 17:32 
        if (( ix = s.index('&')) != nil)
          s.slice!(ix,1)
          @underline = ix #unless @form.nil? # this setting a fake underline in messageboxes
          @text = s # mnemo needs this for setting description
          mnemonic s[ix,1]
        end
        @text = s
      end
      return self 
    end
288296
public static void setMnemonic(AbstractButton button, String mnemonic) {
        char c = ShortTypeHandling.castToChar(mnemonic);
        button.setMnemonic(c);
    }
223136
def setText(self, text):
        
        self._text = nativestring(text)
        if self.showRichText():
            self.richTextLabel().setText(text)
        else:
            super(XPushButton, self).setText(text)
138980
def _parse_button(self, keypad, component_xml):
    """"""
    button_xml = component_xml.find('Button')
    name = button_xml.get('Engraving')
    button_type = button_xml.get('ButtonType')
    direction = button_xml.get('Direction')
    # Hybrid keypads have dimmer buttons which have no engravings.
    if button_type == 'SingleSceneRaiseLower':
      name = 'Dimmer ' + direction
    if not name:
      name = "Unknown Button"
    button = Button(self._lutron, keypad,
                    name=name,
                    num=int(component_xml.get('ComponentNumber')),
                    button_type=button_type,
                    direction=direction)
    return button
69692
def make_buttons names
      @action_buttons = []
      $log.debug "XXX: came to NTP make buttons FORM= #{@form.name} names #{names}  "
      total = names.inject(0) {|total, item| total + item.length + 4}
      bcol = center_column total

      # this craps out when height is zero
      brow = @row + @height-2
      brow = FFI::NCurses.LINES-2 if brow < 0
      $log.debug "XXX: putting buttons :on #{brow} : #{@row} , #{@height} "
      button_ct=0
      tpp = self
      names.each_with_index do |bname, ix|
        text = bname
        #underline = @underlines[ix] if !@underlines.nil?

        button = Button.new nil do
          text text
          name bname
          row brow
          col bcol
          #underline underline
          highlight_bgcolor $reversecolor 
          color $datacolor
          bgcolor $datacolor
        end
        @action_buttons << button 
        button.form = @form
        button.override_graphic  @graphic
        index = button_ct
        tpp = self
        button.command { |form| @selected_index = index; @stop = true; 
          # ActionEvent has source event and action_command
          fire_handler :PRESS, ActionEvent.new(tpp, index, button.text)
          #throw(:close, @selected_index)
        }
        button_ct += 1
        bcol += text.length+6
      end
    end
1030916
def bind_hotkey
      alert "bind_hotkey was called in button"
      if @form.nil? 
        if @underline
          bind(:FORM_ATTACHED){ bind_hotkey }
        end
        return
      end
      _value = @text || getvalue # hack for Togglebutton FIXME
      $log.debug " bind hot #{_value} #{@underline}"
      ch = _value[@underline,1].downcase()[0].ord ##  1.9  2009-10-05 18:55  TOTEST
      @mnemonic = _value[@underline,1]
      # meta key 
      mch = ?\M-a.getbyte(0) + (ch - ?a.getbyte(0))
      @form.bind_key(mch, "hotkey for button #{self.text}" ) { |_form, _butt| self.fire }
    end
125793
def set_bind(self):
        
        self.bind('<Button-1>', lambda e: self.add(0.1))
        self.bind('<Button-3>', lambda e: self.sub(0.1))
        self.bind('<Up>', lambda e: self.add(0.1))
        self.bind('<Down>', lambda e: self.sub(0.1))
        self.bind('<Shift-Up>', lambda e: self.add(1))
        self.bind('<Shift-Down>', lambda e: self.sub(1))
        self.bind('<Control-Up>', lambda e: self.add(10))
        self.bind('<Control-Down>', lambda e: self.sub(10))
        self.bind('<Double-Button-1>', self._dadd)
        self.bind('<Double-Button-3>', self._dsub)
        self.bind('<Shift-Button-1>', lambda e: self.add(1))
        self.bind('<Shift-Button-3>', lambda e: self.sub(1))
        self.bind('<Control-Button-1>', lambda e: self.add(10))
        self.bind('<Control-Button-3>', lambda e: self.sub(10))
        self.bind('<Enter>', self._enter)
1009708
function() {
    this.setColour(Blockly.Blocks.logic.HUE);
    this.appendDummyInput()
        .appendField(Blockly.Msg.CONTROLS_IF_ELSE_TITLE_ELSE);
    this.setPreviousStatement(true);
    this.setTooltip(Blockly.Msg.CONTROLS_IF_ELSE_TOOLTIP);
    this.contextMenu = false;
  }
1192923
public static void setupMenuButton(ButtonBase button, RadialMenuParams params, Node graphic, String tooltip, boolean addStyle) {
        button.minWidthProperty().bind(params.buttonSizeProperty());
        button.minHeightProperty().bind(params.buttonSizeProperty());
        button.prefWidthProperty().bind(params.buttonSizeProperty());
        button.prefHeightProperty().bind(params.buttonSizeProperty());
        button.maxWidthProperty().bind(params.buttonSizeProperty());
        button.maxHeightProperty().bind(params.buttonSizeProperty());

        if (addStyle) {
            button.getStylesheets().addAll(params.getStyleSheets());
        }
        button.setId(params.getStyleId());
        button.getStyleClass().addAll(params.getStyleClasses());

        button.setGraphic(graphic);
        button.setTooltip(new Tooltip(tooltip));
    }
1224214
def button(text, options = {}, &block)
      Button.new(text, {parent: self}.merge!(options), &block)
    end
966234
function getStandardizedButton( button ) {
        if ( $.Browser.vendor === $.BROWSERS.IE && $.Browser.version < 9 ) {
            // On IE 8, 0 == none, 1 == left, 2 == right, 3 == left and right, 4 == middle, 5 == left and middle, 6 == right and middle, 7 == all three
            // TODO: Support chorded (multiple) button presses on IE 8?
            if ( button === 1 ) {
                return 0;
            } else if ( button === 2 ) {
                return 2;
            } else if ( button === 4 ) {
                return 1;
            } else {
                return -1;
            }
        } else {
            return button;
        }
    }
74396
function press(event) {
      if (event.keyCode === 39) {
        Components.Run.make(Components.Direction.resolve('>'));
      }

      if (event.keyCode === 37) {
        Components.Run.make(Components.Direction.resolve('<'));
      }
    }
11874
def _create_buttons
      $log.debug "XXX: INSIDE create_buttons col_offset #{@col_offset} "
      v = Variable.new
      r = @button_row # @row + 1
      col = @col + @col_offset
      @tabs.each_with_index { |t, i| 
        txt = t.text
        @buttons << TabButton.new(nil) do 
          variable v
          text  txt
          name  txt
          #value txt
          row  r
          col col
          surround_chars ['','']
          selected_bgcolor 'green'
          selected_color 'white'

        end
        b = @buttons.last
        b.command do
          set_current_tab i
        end
        b.form = @form
        b.override_graphic  @graphic
        col += txt.length + @button_gap
      }
    end
94087
function misbutton(current, missing) {
    if (arguments.length < 2) {
      current = cwd();
      missing = arguments[0];
    }

    var root = isAbsolute(current) ? '/' : '';
    var curParts = trimArray(current.split('/'));
    var misParts = trimArray(missing.split('/'));
    var length = curParts.length;
    var sameIndex = 0;

    for (var i = 0; i < length; i += 1) {
      if (curParts[i] === misParts[sameIndex]) {
        sameIndex += 1;
      }
    }
    var diffLength = length - sameIndex;
    var head = curParts.slice(0,diffLength);
    var res = head.concat(misParts);

    return root + res.join('/');
  }
858804
def on_press(self, event):
        ''
        if event.inaxes != self.ax:
            return
        # contains, attrd = self.rect.contains(event)
        # if not contains: return
        # print('event contains', self.rect.xy)
        # x0, y0 = self.rect.xy
        self.press = [event.xdata], [event.ydata], event.button
323522
function WidgetButton() {
        this.addOutput("", LiteGraph.EVENT);
        this.addOutput("", "boolean");
        this.addProperty("text", "click me");
        this.addProperty("font_size", 30);
        this.addProperty("message", "");
        this.size = [164, 84];
        this.clicked = false;
    }
874864
def char_on(self, c):
        
        if c.upper() in CHARACTERS:
            for i in CHARACTERS[c.upper()]:
                self.light_on(BUTTONS[i])