-
Notifications
You must be signed in to change notification settings - Fork 6
Text Containers
TODO: Text here
The Label class is the most basic way of getting text onto the screen. A Label gadget can display a single line of text at a given set of co-ordinates. The text within the label can be aligned horizontally to the left, right or centre of the gadget, and aligned vertically to the top, bottom or centre.
A limitation of the Label is that it does not scroll. Though the string it contains can be any length, limited only by available RAM, only the portion of the string that fits within the label will be displayed.
// Create the label
Label* label = new Label(10, 10, 100, 30, "Some text");The TextBox extends the Label with facilities to allow users to edit the string within the gadget. It can display a cursor that the user can move either by using the DS’ d-pad or by clicking the TextBox with the stylus. Double-clicking the TextBox will automatically pop up a keyboard allowing the user to type into the gadget, though this behaviour can be disabled. Unlike the Label, the contents of the TextBox scrolls to follow the cursor.
// Create the textbox
TextBox* textbox = new TextBox(10, 10, 100, 30, "Some text");Though the TextBox can scroll horizontally to follow the cursor, allowing more text to be visible than the Label, it is still limited to a single line of text. The MultiLineTextBox provides a textbox that can contain multiple lines of text. Scrolling through the text is achieved by dragging the contents of the textbox with the stylus up or down. The text is automatically wrapped to fit the width of the textbox.
Like the TextBox, the MultiLineTextBox provides a cursor that can be moved through the text via stylus taps or the d-pad. It can be hidden if the textbox is to be used for display only. When double-clicked, it opens up the keyboard. Again, this functionality can be disabled.
TODO: Discuss the way the textbox forgets the topmost rows. Should it be possible to make the textbox remember all rows? TODO: Example usage TODO: Picture
The ScrollingTextBox is a compound gadget consisting of a MultiLineTextBox and a ScrollbarVertical. It functions in the same way as a MultiLineTextBox, but includes a scrollbar on the right of the textbox.
TODO: Picture TODO: Example usage