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
TheFl_Box widget simply draws its box and optionally its label. It is useful as a visual frame around other widgets or as a placeholder in layouts.
Header File
Class Overview
Fl_Box is a simple widget that displays a box with an optional label. While invisible by default (with FL_NO_BOX), it can be made visible by setting an appropriate box type. It’s commonly used to:
- Draw frames around groups of widgets
- Display static text labels
- Serve as placeholders in resizable layouts
- Act as
Fl_Group::resizable()values
Inheritance
Fl_Widget
Constructors
Default Constructor
Fl_Box widget with the given coordinates, 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
Optional text for the widget label
This constructor sets
box() to FL_NO_BOX, making the widget invisible by default. Use box(Fl_Boxtype) to make it visible.Boxtype Constructor
Fl_Box widget with a specific box type.
The box type to display (e.g.,
FL_UP_BOX, FL_DOWN_BOX, FL_BORDER_BOX)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
Text for the widget label (can be
nullptr)Public Methods
handle()
The FLTK event type (e.g.,
FL_PUSH, FL_DRAG, FL_RELEASE)int - 1 if handled, 0 otherwise
Protected Methods
draw()
Inherited Methods
As a subclass ofFl_Widget, Fl_Box inherits all standard widget methods including:
box()/box(Fl_Boxtype)- Get or set the box typelabel()/label(const char*)- Get or set the label textcolor()/color(Fl_Color)- Get or set the background colorlabelcolor()/labelcolor(Fl_Color)- Get or set the label colorlabelfont()/labelfont(Fl_Font)- Get or set the label fontlabelsize()/labelsize(Fl_Fontsize)- Get or set the label sizealign()/align(Fl_Align)- Get or set label alignment
Usage Example
Common Box Types
FL_NO_BOX- No box (invisible, default for default constructor)FL_FLAT_BOX- Flat box with color fillFL_UP_BOX- Raised boxFL_DOWN_BOX- Sunken boxFL_BORDER_BOX- Box with border outlineFL_SHADOW_BOX- Box with drop shadowFL_ROUNDED_BOX- Box with rounded cornersFL_ENGRAVED_BOX- Engraved border effect