schm...@gmx.de
unread,Feb 14, 2024, 2:15:23 AMFeb 14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to wx-u...@googlegroups.com
Hi,
I have a wxStaticText which Label can change at runtime. After this, the
sizers aren't updated. After a resize of the window, or minimising and
getting the window back, everything is fine.
I tested it with wxWidgets 3.2.4 and Windows 10. But it happens with
older wx versions too.
For demonstrating the problem, I've the following code which can be
copied in the minimal sample:
auto sizer = new wxBoxSizer(wxHORIZONTAL);
label = new wxStaticText(this, wxID_ANY, "test");
sizer->Add(label, 0, wxGROW);
auto input = new wxTextCtrl(this, wxID_ANY, "Init String",
wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_RICH2);
sizer->Add(input, 0, wxGROW);
input->Bind(wxEVT_TEXT_ENTER, [this](wxCommandEvent& evt)
{
label->SetLabel(evt.GetString());
Update();
Refresh();
});
SetSizerAndFit(sizer);
It's just for demonstrating. When you enter a text, which is longer than
the old text in the text control, the label moves behind the textCtrl.
But, even when only resizing the window in vertical direction it
repaints the window and everything is fine.
Is there an other way to force a refresh of the window beside Update()
and Refresh()?
Best regards
Stefan