The Green Shoes Manual 1.1.362

EditLine

Edit lines are a slender, little box for entering text. While the EditBox is multi-line, an edit line is just one. Line, that is. Horizontal, in fact.

The unstyled edit line is 200 pixels wide and 28 pixels wide. Roughly. The height may vary on some platforms.

 Shoes.app do
   stack do
     edit_line
     edit_line width: 400
   end
 end

You can change the size by styling both the :width and the :height. However, you generally only want to style the :width, as the height will be sized to fit the font. (And, in current versions of Green Shoes, the font for edit lines and edit boxes cannot be altered anyway.)

If a block is given to an edit line, it receives change events. Check out the EditBox page for an example of using a change block. In fact, the edit box has all the same methods as an edit line. Also see the list of Common methods, which all elements respond to.

Each time a character is added to or removed from the edit line, its change block is called. The block is given self, which is the edit line object which has changed.

focus() » self

Moves focus to the edit line. The edit line will be highlighted and the user will be able to type into the edit line.

text() » self

Return a string of characters which have been typed into the box.

Fills the edit line with the characters of a string.

Next: Image