Sha256: b8e531ba2e90ff4f12cc6a76a184d373c3a9a791d3ca6bb977f3ef3f0fe42eef

Contents?: true

Size: 754 Bytes

Versions: 16

Compression:

Stored size: 754 Bytes

Contents

require_relative 'helpers/example_window'

class ExampleState < Fidgit::GuiState
  def initialize
    super

    vertical do
      my_label = label "No button selected"

      button("Deselect") do
        @group.value = nil
      end

      button("Select #7") do
        @group.value = 7
      end

      @group = group do
        grid num_columns: 5, padding: 0 do
          15.times do |i|
            radio_button "##{i}", i, width: 60
          end
        end

        subscribe :changed do |sender, value|
          my_label.text = if value
            "Button #{value.to_s} selected"
          else
            "No button selected"
          end
        end
      end
    end
  end
end

ExampleWindow.new.show

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
fidgit-0.2.4 examples/radio_button_example.rb
fidgit-0.2.3 examples/radio_button_example.rb
fidgit-0.2.2 examples/radio_button_example.rb
fidgit-0.2.1 examples/radio_button_example.rb
fidgit-0.2.0 examples/radio_button_example.rb
fidgit-0.1.10 examples/radio_button_example.rb
fidgit-0.1.9 examples/radio_button_example.rb
fidgit-0.1.8 examples/radio_button_example.rb
fidgit-0.1.7 examples/radio_button_example.rb
fidgit-0.1.6 examples/radio_button_example.rb
fidgit-0.1.5 examples/radio_button_example.rb
fidgit-0.1.4 examples/radio_button_example.rb
fidgit-0.1.3 examples/radio_button_example.rb
fidgit-0.1.2 examples/radio_button_example.rb
fidgit-0.1.1 examples/radio_button_example.rb
fidgit-0.1.0 examples/radio_button_example.rb