Sha256: cb0e03833425ed4e409dfa3ee06cf1147558e90d698060a8101dcbc3b0b492f4

Contents?: true

Size: 729 Bytes

Versions: 5

Compression:

Stored size: 729 Bytes

Contents

require_relative 'helpers/example_window'

# Labels can have text and/or icons.
class ExampleState < Fidgit::GuiState
  def initialize
    super

    pack :vertical do
      my_label = label "Right click to open context menu"

      my_label.subscribe :released_right_mouse_button do
        menu do
          item "Chunky bacon", :CHUNKY_BACON, shortcut: "Ctrl-^-*"
          separator
          item "Lentils", :LENTILS, shortcut: "Alt-F15"
          item "Tepid gruel", :GRUEL, shortcut: "CenterMeta"

          subscribe :selected do |sender, value|
            my_label.text = "I like #{value} more than anything. Mmmm!"
          end
        end
      end
    end
  end
end

ExampleWindow.new.show

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
fidgit-0.0.6alpha examples/menu_pane_example.rb
fidgit-0.0.5alpha examples/menu_pane_example.rb
fidgit-0.0.4alpha examples/menu_pane_example.rb
fidgit-0.0.3alpha examples/menu_pane_example.rb
fidgit-0.0.2alpha examples/menu_pane_example.rb