Fl::set_color and FL_SELECTION_COLOR doesn't work

25 views
Skip to first unread message

Dibo

unread,
Oct 17, 2026, 7:03:29 AMOct 17
to fltk.general
Hi,

When I use Fl::set_color with any FL_BACKGROUND_COLOR, FL_BACKGROUND2_COLOR etc. then it works fine. But with FL_SELECTION_COLOR nothing happen:
Fl::set_color(FL_SELECTION_COLOR, 0, 255, 0);

Widgets still have default dark blue color. I must set selection color manually for all widgets:
    m_cb_profile = new Fl_Choice(0, 0, 30, 30);
    m_cb_profile->selection_color(Fl::get_color(FL_SELECTION_COLOR));

Above works fine now. Anyone know why it doesn't work by default? I'm calling Fl::set_color before creating main window and after that I also call Fl::reload_scheme(); and Fl::redraw();

I'm using FLTK 1.4.5 on CachyOS (Arch) with KDE Plasma and FLTK compiled with wayland

Dibo

unread,
Oct 17, 2026, 7:13:45 AMOct 17
to fltk.general
Found solution with Claude. It is because I call show with args:
window->show(argc, argv)

Changing it to:
window->show()

Solved problem

Matthias Melcher

unread,
Oct 17, 2026, 6:48:40 PMOct 17
to fltk.general
It would probably be best to call Fl::args(argc, args) early, which loads a few desktop resources, then set the selection color, and then later call show() without argc and argv. Best of both worlds.


Reply all
Reply to author
Forward
0 new messages