#include <ugadgets.hpp>
Inheritance diagram for UTextbox:
Public Member Functions | |
UTextbox (const UArgs &=UArgs::none) | |
constructor; see also ~UGroup() and the creator shortcut utextbox() | |
virtual const UStyle & | getStyle (UContext *) const |
Static Public Member Functions | |
static const UStyle & | makeStyle () |
Static Public Attributes | |
static UStyle * | style = null |
Friends | |
UTextbox & | utextbox (const UArgs &a=UArgs::none) |
creator shortcut that is equivalent to *new UTextbox(). |
The main puropose of this class is to display text. Use UTextfield to edit a single line of text and UFlowbox or UTextarea to edit multi-line text regions.
By opposition to UBox objects, UTextbox, UTexfield, UFlowbox... keep their initial size. For this reason, they are well suited for displaying text that is dynamically changed (the layout of the GUI will be more stable and calculated faster).
Geometry (default behavior):
Default Properties:
Examples:
UTextbox& tb1 = utextbox( "This textbox will display this string" )
UStr& msg = ustr("error message"); UTextbox& tb2 = utextbox( UPix::ray + "Warning: Error: " + msg );
msg = "another message"; // changes 'msg' and updates 'txb2'
// collates the text enclosed in the textbox and copies it to 's' // 's' will contain: "Warning: Error: another message" UStr s = tb2.copyText();
Callbacks and Editable text: The UTextfield subclass provides text edition:
utextfield( "bla bla" );This is functionally equivalent to:
utextbox( uedit() + "bla bla" );See: classes UTextfield and UEdit for callbacks and other functions.