Skip to content
Unknown edited this page Apr 25, 2013 · 3 revisions

Description

The textbox class is directly derived from Widget. It provides a text entry area and additionally a pop-up keyboard which appears directly below the text. To show the keyboard, the text area should be tapped once. A second tap will hide the keyboard again. Although it would be possible to implement every single key as a widget, this would unnecessarily increase network traffic. As the ordered layout of the keys provides an easy way to map tap locations to keys, the keyboard is implemented as a single widget.

Definition

class Textbox: public Widget

'''Constructor''' Textbox( int _w, int _h0, int _h1, int _x = 0, int _y = 0, double angle = 0.0, RGBATexture* _tex = 0 ) creates a new textbox widget. All parameters are equal to those in the base widget with the exception of the two height parameters h0,h1. As the widget can have two states, h0 specifies the height in retracted state whereas h1 specifies the expanded height. Note that the ratio between these two heights should also be reflected in the texture, as the lower part (h1 - h0) will be hidden in retracted state. When no texture is specified, then the widget will load a default texture from "Textbox.png".

Methods

  • std::string get() retrieves a copy of the current text field contents.
  • void set( std::string text ) changes the text field contents.
TISCH