Documentation Index
Fetch the complete documentation index at: https://mintlify.com/fltk/fltk/llms.txt
Use this file to discover all available pages before exploring further.
Fl_Output
TheFl_Output widget displays a piece of text in a read-only field. Users can select and copy the text but cannot edit it.
Header File
Class Overview
Fl_Output is a read-only text display widget that:
- Displays static or program-generated text
- Allows users to select text with the mouse
- Supports copying selected text to clipboard
- Uses
strcpy()to maintain its own copy of the value - Handles UTF-8 and displays control characters using ^X notation
For multiline output, use
Fl_Multiline_Output. For more advanced text display with scrolling, use Fl_Text_Display.Inheritance
Fl_Input (which inherits from Fl_Input_ and Fl_Widget)
Constructor
Fl_Output widget with the given position, size, and label.
The X coordinate of the widget relative to the enclosing window
The Y coordinate of the widget relative to the enclosing window
Width of the widget in pixels
Height of the widget in pixels
Label text displayed next to the output field
The default box type is
FL_DOWN_BOX, giving it a sunken appearance.Inherited Methods
SinceFl_Output inherits from Fl_Input, it has access to all input methods, but editing operations are disabled. The most commonly used methods include:
Text Management
value()/value(const char*)- Get or set the displayed textsize()- Get the length of text in bytes
Selection
position()/position(int)- Get or set cursor/selection positionmark()/mark(int)- Get or set selection markposition(int, int)- Set selection range
Appearance
textcolor()/textcolor(Fl_Color)- Get or set text colortextfont()/textfont(Fl_Font)- Get or set text fonttextsize()/textsize(Fl_Fontsize)- Get or set text sizecolor()/color(Fl_Color)- Get or set background color
Display Behavior
The text displayed inFl_Output:
- Can contain any characters except
\0 - Displays unprintable control characters using ^X notation (e.g., ^M for carriage return)
- Displays unprintable characters with the high bit set using \nnn notation
- Assumes the font can draw any characters in the ISO-Latin1 character set
- Supports full UTF-8 text rendering
Usage Example
Status Display Example
Multiline Output Example
Differences from Fl_Input
WhileFl_Output inherits from Fl_Input, the key differences are:
| Feature | Fl_Input | Fl_Output |
|---|---|---|
| Editing | Allowed | Not allowed |
| Text Selection | Yes | Yes |
| Copy to Clipboard | Yes | Yes |
| Paste from Clipboard | Yes | No |
| Keyboard Input | Accepted | Ignored (except copy commands) |
| Default Box | FL_DOWN_BOX | FL_DOWN_BOX |
| Primary Use | User input | Display program output |
Common Use Cases
- Status displays - Show application status or messages
- Calculated results - Display computation results
- Read-only information - Show configuration or system info
- Log viewers - Display log messages (single line)
- Data presentation - Show formatted data to users
See Also
- Fl_Input - Editable text input widget
- Fl_Text_Display - Multi-line text display with scrolling
- Fl_Multiline_Output - Multi-line read-only output
- Fl_Box - Simple label display