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_Box
Header:FL/Fl_Box.H
The Fl_Box widget is the simplest FLTK widget - it displays a box and optionally a label. While it cannot receive events or user interaction, it’s extremely useful for:
- Displaying static text labels
- Creating decorative frames around other widgets
- Acting as a spacer or resizable placeholder
- Drawing background panels
Constructor
x, y- Position relative to parent windoww, h- Width and height in pixelslabel- Optional text to display (default: no label)box- Box type (border/background style)
Key Properties
box() - Box Type
box() - Box Type
Controls the visual appearance of the box border and background.Default:
FL_NO_BOX (invisible)Common box types:FL_NO_BOX- No border or background (invisible)FL_FLAT_BOX- Flat colored rectangleFL_UP_BOX- Raised 3D borderFL_DOWN_BOX- Depressed 3D borderFL_BORDER_BOX- Simple thin borderFL_THIN_UP_BOX- Thin raised borderFL_THIN_DOWN_BOX- Thin depressed border
label() - Display Text
label() - Display Text
The text displayed inside or near the box.
color() - Background Color
color() - Background Color
Sets the background color of the box.
align() - Label Alignment
align() - Label Alignment
Controls how the label is positioned relative to the box.
Examples
Common Use Cases
Title Displays
Use Fl_Box for section headers and titles in your UI.
Status Bars
Display application status or information at window bottom.
Decorative Panels
Create visual separators and grouped sections.
Image Display
Show images using Fl_Box with image() method.
Visual Description
An Fl_Box appears as a rectangular region that can have various border styles:- FL_NO_BOX: Completely invisible, only label may show
- FL_FLAT_BOX: Solid colored rectangle with no border
- FL_UP_BOX: Appears raised with 3D shading effect
- FL_DOWN_BOX: Appears recessed/pressed into the window
- FL_BORDER_BOX: Simple thin black outline
- FL_ENGRAVED_BOX: Looks carved into surface
- FL_EMBOSSED_BOX: Looks raised from surface
Important Notes
The default constructor creates an invisible box with
FL_NO_BOX. You must call box() to make it visible, or use the alternate constructor that accepts a box type.Related Widgets
- Fl_Button - Interactive clickable version
- Fl_Output - Display-only text field with input styling
- Fl_Group - Container widget (can also display boxes)
Reference
See source file:FL/Fl_Box.H