Browser widgets display scrolling lists of text items. FLTK provides several browser variants for different selection behaviors.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_Browser
Header:FL/Fl_Browser.H
The base browser class displays a scrolling list of text lines with full control over formatting, icons, and styling.
Constructor
Key Methods
add() - Add Items
add() - Add Items
Add text lines to the browser.Note: Line numbers start at 1, not 0.
remove() / clear() - Delete Items
remove() / clear() - Delete Items
Remove items from the browser.
text() - Get Item Text
text() - Get Item Text
Retrieve the text of a specific line.
value() - Current Selection
value() - Current Selection
Get or set the selected line.
size() - Number of Items
size() - Number of Items
Get the total number of items.
load() - Load from File
load() - Load from File
Load browser contents from a text file.
Format Codes
Format Codes
Use special format codes to style individual lines.Format codes start with
@ character:@b- Bold text@i- Italic text@for@t- Fixed-width font@l- Large (24pt) font@m- Medium (18pt) font@s- Small (11pt) font@c- Center aligned@r- Right aligned@uor@_- Underlined@C###- Text color (0-255)@B###- Background color (0-255)@.- Stop format parsing
Browser Types
Set the browser type to control selection behavior:Example from Source
Visual Description
A browser appears as a scrollable rectangular area with a thin border. Text items are listed vertically. Selected items are highlighted with a blue background. Vertical scrollbar appears when content exceeds height.Fl_Select_Browser
Header:FL/Fl_Select_Browser.H
Default browser type with single selection. Clicking an item selects it and deselects others.
Fl_Hold_Browser
Header:FL/Fl_Hold_Browser.H
Selection persists until another item is clicked. Good for lists where user might click elsewhere then return.
Fl_Multi_Browser
Header:FL/Fl_Multi_Browser.H
Allows selecting multiple items using Ctrl+click (add to selection) or Shift+click (range selection).
Fl_File_Browser
Header:FL/Fl_File_Browser.H
Specialized browser for displaying file system contents with icons and sorting.
Fl_Check_Browser
Header:FL/Fl_Check_Browser.H
Browser where each item has a checkbox. User can check/uncheck items independently.
Browser Gallery
Select Browser
Fl_Select_Browser - Single selectionStandard list with single-select behavior.Use for: Choosing one option from a list
Multi Browser
Fl_Multi_Browser - Multiple selectionAllows Ctrl+click and Shift+click for multi-select.Use for: Selecting multiple files, items, or options
File Browser
Fl_File_Browser - File systemShows files and directories with icons and type filtering.Use for: File selection dialogs, directory browsing
Check Browser
Fl_Check_Browser - Checkbox listEach item has independent checkbox.Use for: Feature toggles, option lists, permissions
Common Patterns
Dynamic Item List
Column-based Display
Searchable List
Custom Icon Display
Important Notes
The format_char() can be changed from ’@’ to another character if you need to display ’@’ symbols in your text.
Reference
- Source:
FL/Fl_Browser.H(lines 32-331) - Source:
FL/Fl_File_Browser.H - Source:
FL/Fl_Check_Browser.H - Example:
test/browser.cxx - Example:
examples/browser-simple.cxx