Re: Update sizer after changing label of a wxStaticText
Igor Korot <[email protected]>
| Newsgroups | gmane.comp.lib.wxwindows.general |
|---|---|
| Message-ID | <CA+FnnTxaQP7PKVnjXXnzcnp4YYw0ZzbAcHFAfmQvJUAJQsxFtw@mail.gmail.com> |
Hi, On Wed, Feb 14, 2024, 5:05 AM 'Stefan Kruse' via wx-users < [email protected]> wrote: > 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. > Try calling Layout() on the topmost sizer. Thank you. > 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/F2293FDB-C830-4A9E-A687-1BDB240D628B%40gmx.de > <https://groups.google.com/d/msgid/wx-users/F2293FDB-C830-4A9E-A687-1BDB240D628B%40gmx.de?utm_medium=email&utm_source=footer> > . > -- 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%2BFnnTxaQP7PKVnjXXnzcnp4YYw0ZzbAcHFAfmQvJUAJQsxFtw%40mail.gmail.com.