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.
What This Example Demonstrates
This example demonstrates the absolute basics of creating an FLTK application:- Creating a window (
Fl_Window) - Adding a widget to display text (
Fl_Box) - Customizing appearance with fonts, sizes, and box styles
- Running the FLTK event loop
Complete Source Code
Source file:test/hello.cxx
Compilation Command
Expected Output
When you run this program, you’ll see:- A 340x180 pixel window
- Text reading “Hello, World!” in bold italic font
- Font size of 36 points
- Shadow effect on the text
- A raised box style (FL_UP_BOX) around the text
Key Concepts
Window Creation
Widget Positioning
Fl_Box(x, y, width, height, label)
- x=20, y=40: position from top-left corner
- width=300, height=100: size of the box
Box Styles
box->box(FL_UP_BOX) sets the visual style. Other options include:
FL_DOWN_BOX- recessed appearanceFL_FLAT_BOX- no borderFL_BORDER_BOX- simple borderFL_NO_BOX- invisible
Font Properties
+ and set size in points.
Event Loop
show()displays the window and parses command-line argumentsFl::run()starts the event loop and handles user interaction
Variations and Extensions
Centered Text
Different Colors
Window Title
Minimum Window Size
Next Steps
- Learn about buttons and callbacks
- Explore input fields
- Understand layout management