Sha256: c7973f7d0cd8bbca43cdd8114c412ef66f3c40967d3b506246b2a226969b6e3d

Contents?: true

Size: 775 Bytes

Versions: 5

Compression:

Stored size: 775 Bytes

Contents

require_relative 'helpers/example_window'

# Example for Button and ToggleButton
class ExampleState < Fidgit::GuiState
  def initialize
    super

    pack :vertical do
      my_label = label "Label", tip: "I'm a label"

      my_button = button("Button", tip: "I'm a button; press me!") do
        my_label.text = "Pressed the button!"
      end

      my_toggle_button = toggle_button("ToggleButton", tip: "I'm a button that toggles") do |sender, value|
        my_label.text = "Turned the toggle button #{value ? "on" : "off"}!"
      end

      toggle_button("Enable other two buttons", value: true) do |sender, value|
        my_button.enabled = value
        my_toggle_button.enabled = value
      end
    end
  end
end

ExampleWindow.new.show

Version data entries

5 entries across 5 versions & 1 rubygems

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