|
|
środa, 6 lipca 2022 o 13:00:45 UTC+2 Ian MacArthur napisał(a):
On Wed, 6 Jul 2022 at 11:54, Jck_01 wrote:
Hello, I create the application with the FLTK library. Almost everything works as it should, except one important thing, and
I couldn't find the right solution so far.
Random artifacts appear in the window. They also appear randomly - sometimes everything is displayed correctly, but sometimes there are strange lines, some parts of the controls are not refreshed etc. I tried to use Fl::check() but it didn't help in every case. Please see the included examples (a strange black line over the window, a strange blue line over the button, and a broken frame around the button). How can I avoid these problems?
We'd probably have to see some code to tell, but to me it looks like you are drawing outside the valid context.
Hmm; Is this on Windows?
Yes, this is on Windows 10.
The order and setting of the "pens" in Windows is a bit sensitive, so you need to ensure you do that in the correct order too. I think that is discussed in the docs, FWIW. Maybe you can post a small, compile-able example that shows what you are doing that gets this effect?
I will show only most important parts of the code since it involves many classes and is quite complicated.
First I create the dialog window as the new class where inside I define the pointer to the Fl_window. using WindowPtr = std::unique_ptr<Fl_Window>; WindowPtr windowPtr;
Then, in the class I create the controls, for example: windowPtr = std::make_unique<Fl_Window>(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
connectToServerButton = std::make_unique<Fl_Button>(20, 268, 200, 30, nullptr); connectToServerButton->copy_label(gui.getTranslation().Translate(u8"Connect to server").c_str()); connectToServerButton->callback(connectToServerCallback, this);
windowPtr->end();
Then, in the connectToServerCallback() callback I do following (netMessages is a multiline edit control):
netMessages->value(u8""); addMessage(gui.getTranslation().Translate(u8"Connecting to server...")); Fl::check(); int ret = gui.getNet().getClient().start(); // starting the network client if (ret != Network::NET_OK) // error { } else // client connected to server { addMessage(gui.getTranslation().Translate(u8"Connected!").c_str()); connectToServerButton->deactivate(); }
When I click the connectToServerButton, I sometime receive the artifacts on the whole dialog or on button.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/1ee2bb09-19d9-4e4f-bf09-11786f7c4e4bn%40googlegroups.com.
[ Direct Link to Message ] | |
|
| |