FLTK logo

Re: [fltk.general] Strange artefacts visible on controls

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Strange artefacts visible on controls Jck_01 Jul 08, 2022  
 


    {
        addMessage(gui.getTranslation().Translate(u8"Connected!").c_str());

Just an idea, but maybe the problem is here ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^. Maybe it operates on temporary objects or takes the pointer produced by c_str() and the problem is in the pointer handling? Just guessing. 
 
  It's strange but I found another line which created the artifacts, and this line used the FLTK GUI. Namely, at the end of the callback for the startButton I used the following line:
startButton->deactivate();

(the startButton is of type Fl_Button)

When I commented out this line, evertything started to work correctly, no artifacts. So I moved this line before following line:
addMessage(gui.getTranslation().Translate(u8"Connected!").c_str());

So now the code looks like this:
startButton->deactivate();
addMessage(gui.getTranslation().Translate(u8"Connected!").c_str());


Now there are no artifacts at all. The addMessage() method is following:
void GUIDlgNetClient::addMessage(std::string msg)
{
    netMessages->insert(msg.c_str());
    netMessages->insert(u8"\n");
    Fl::check();
}

The netMessages is definied like this:
using FlMultilineOutputPtr = std::unique_ptr<Fl_Multiline_Output>;
FlMultilineOutputPtr netMessages;


Seems there is a strange coincidence between the Fl_Multiline_Output (netMessages) and the Fl_Button (startButton). If I write something to Fl_Multiline_Output, and then disable the button, I get the artifacts. When I first disable the button and then write to Fl_Multiline_Output, everything is OK.
       

--
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/8b7ce3df-300d-4c8d-83fd-1014a27c70bfn%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.