Sha256: 8222a3935e9c55e59854c35fd6230ddcbe5d5d3c894e1b58dc82599d02392760

Contents?: true

Size: 767 Bytes

Versions: 5

Compression:

Stored size: 767 Bytes

Contents

require_relative 'helpers/example_window'

class ExampleState < Fidgit::GuiState
  def initialize
    super

    pack :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
        pack :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

5 entries across 5 versions & 1 rubygems

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