Re: Update sizer after changing label of a wxStaticText

"'Stefan Kruse' via wx-users" <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
Sorry, but I've to come back to my question.

Ist there any trick when the window is part of a wxAuiNotebook? 

Layout() on the toplevel frame or on the concerned pane has no effect.

I also tried to update the wxAuiManager with no effect.

Thank you in advance,

Stefan 

Am 14. Februar 2024 09:43:01 MEZ schrieb 'Stefan Kruse' via wx-users <[email protected]>:
>Great, thank you!
>
>Am 14. Februar 2024 09:05:06 MEZ schrieb Igor Korot <[email protected]>:
>>Hi,
>>
>>On Wed, Feb 14, 2024, 1:15 AM schmensch via wx-users <
>>[email protected]> wrote:
>>
>>> 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.
>>>
>>
>>You need to call Layout() on the window after changing the text.
>>
>>Update() and Refresh() have no business there - it is to repaint the window.
>>
>>Thank you.
>>
>>
>>> 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
>>>
>>> --
>>> Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
>>> ---
>>> You received this message because you are subscribed to the Google Groups
>>> "wx-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send an
>>> email to [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/wx-users/792d0cfb-f7a8-4430-b422-105c591434ee%40gmx.de
>>> .
>>>
>>
>>-- 
>>Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
>>--- 
>>You received this message because you are subscribed to the Google Groups "wx-users" group.
>>To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
>>To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/CA%2BFnnTxXgBxoE-k7Bd7i-pSq%2BKHQ4xiyk5jrUAaJmey5qw-ryg%40mail.gmail.com.
>
>-- 
>Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
>--- 
>You received this message because you are subscribed to the Google Groups "wx-users" group.
>To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
>To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/666CB5A8-D180-4BC4-A46E-9CB135FE9984%40gmx.de.

-- 
Please read https://www.wxwidgets.org/support/mlhowto.htm before posting.
--- 
You received this message because you are subscribed to the Google Groups "wx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wx-users/F2293FDB-C830-4A9E-A687-1BDB240D628B%40gmx.de.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.