Sha256: da47be300371f6ddc47ca8e70095fbee0eb0f97d573b601e572e654f474959c8

Contents?: true

Size: 708 Bytes

Versions: 6

Compression:

Stored size: 708 Bytes

Contents

Shoes.app :title => "Search sample", :width => 300, :height => 400 do
  msg = "Enter a search."
  stack :margin => 5 do
    @search = edit_line :width => 280

    @search.change do |search|
      if search.text.empty?
        @results.clear{ para msg }
      else
        @results.clear { do_search(search.text) }
      end 
    end

    @results = flow{ para msg }
  end
end

def do_search(word)
  
  data = %w{ place plan plant plot face race rails ruby train trouble double }
  
  data.each do |entry|
    if /#{word}/ =~ entry
      @results.append do 
        stack :margin_top => 5 do 
          background lightyellow, :curve => 6
          para entry
        end
      end
    end         
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
scarpe-0.4.0 examples/legacy/not_checked/shoes-contrib/basic/search.rb
scarpe-0.3.0 examples/legacy/not_checked/shoes-contrib/basic/search.rb
scarpe-0.2.2 examples/legacy/not_checked/shoes-contrib/basic/search.rb
lacci-0.2.1 examples/legacy/not_checked/shoes-contrib/basic/search.rb
scarpe-0.2.1 examples/legacy/not_checked/shoes-contrib/basic/search.rb
scarpe-0.2.0 examples/legacy/not_checked/shoes-contrib/basic/search.rb