1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Edit Boxes


3 of 3

Multi-line edit_box
Edit Boxes

An edit_box works exactly the same as an edit_line, with one slight difference. An edit_box allows you to edit multiple lines, whereas an edit_line only allows you to edit a single line. Using only an edit_line, edit_box and two buttons, you can make a crude text editor.

Shoes.app :width => 400, :height => 300 do
  flow do
    @e = edit_line :width => -50
    button "Load", :width => 50 do
      @box.text = File.read( @e.text )
  stack do
    @box = edit_box :width => '100%', :height => 230
    button "Save", :width => '100%' do
      File.open( @e.text, 'w+' ) do|f|
        f.write @box.text
  1. About.com
  2. Technology
  3. Ruby
  4. Graphical User Interfaces
  5. Shoes
  6. Multi-line edit_box

©2014 About.com. All rights reserved.