Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

51 lines (33 sloc) 1.406 kb

No. 6: edit_line

Edit boxes are wide, rectangular boxes for entering text (think of the HTML "textarea" tag). Edit lines are slender, little boxes for entering one line of text (think of the HTML "input" tag).

# sample7.rb
Shoes.app :width => 250, :height => 300 do
  stack do
    @msg = para 'Hello'
    @el = edit_line "We love Ruby."
    button('ok'){ @msg.text = @el.text}
    @eb = edit_box "We love Shoes."
    button('ok'){ @msg.text = @eb.text}
  end
end

sample7.png

sample7.png

We can use the attribute :secret for creating password fields with edit_line (think of type="password" in HTML "input" tags):

# sample7-1.rb
Shoes.app :width => 235, :height => 80 do
  para 'password: '
  @el = edit_line :width => 100, :secret => true
  button('ok'){@input.replace em(@el.text)}
  @input = para ''
end

sample7-1.png

sample7-1.png

Policeman

The sample7.rb and sample7-1.rb worked with Shoes-0.r1263. Looked like slightly degraded. But not so bad.

sample7-2.png

sample7-2.png

sample7-3.png

sample7-3.png

Jump to Line
Something went wrong with that request. Please try again.