Set window class name (xclass) in test/editor

... to avoid side effects under Windows where the default would
prevent entering emoji's with the emoji palette if the WNDCLASS
begins with "edit" (conflict with a system WNDCLASS).

This is also documented in the respective tutorial chapter.
This commit is contained in:
Albrecht Schlosser 2026-02-08 17:59:01 +01:00
parent b9ff72c573
commit 6f8ed5a85d
2 changed files with 8 additions and 1 deletions

View File

@ -57,6 +57,7 @@ Fl_Double_Window *app_window = NULL;
void tut1_build_app_window() { void tut1_build_app_window() {
app_window = new Fl_Double_Window(640, 480, "FLTK Editor"); app_window = new Fl_Double_Window(640, 480, "FLTK Editor");
app_window->xclass("fl_editor");
} }
int main (int argc, char **argv) { int main (int argc, char **argv) {
@ -66,6 +67,11 @@ int main (int argc, char **argv) {
} }
\endcode \endcode
Note: setting the xclass() of the window is not required but it is considered
good style. In this case it works around a known side effect under \b Windows
where leaving the default ("editor.exe") would prevent entering emojis with
the emoji palette. You can ignore this for now in this tutorial.
Passing `argc` and `argv` to `Fl_Double_Window::show()` allows FLTK to parse Passing `argc` and `argv` to `Fl_Double_Window::show()` allows FLTK to parse
command line options, providing the user with the ability to change the command line options, providing the user with the ability to change the
color or graphical scheme of the editor at launch time. color or graphical scheme of the editor at launch time.

View File

@ -4,7 +4,7 @@
// This program is described in chapter "Designing a Simple Text Editor" // This program is described in chapter "Designing a Simple Text Editor"
// of the FLTK Programmer's Guide. // of the FLTK Programmer's Guide.
// //
// Copyright 1998-2025 by Bill Spitzak and others. // Copyright 1998-2026 by Bill Spitzak and others.
// //
// This library is free software. Distribution and use rights are outlined in // This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this // the file "COPYING" which should have been included with this file. If this
@ -31,6 +31,7 @@ Fl_Double_Window *app_window = NULL;
void tut1_build_app_window() { void tut1_build_app_window() {
app_window = new Fl_Double_Window(640, 480, "FLTK Editor"); app_window = new Fl_Double_Window(640, 480, "FLTK Editor");
app_window->xclass("fl_editor");
} }
#endif #endif