When placing a wxCheckBox at the top of a wxStaticBox, as per the constructor, here, there is a break in the surrounding box in the top-right corner.
No break in the surrounding box is expected. The break disappears if I replace the wxCheckbox with a wxString label.
The issue is reproduced in the following MWE:
#include <wx/wx.h>
class MyFrame:public wxFrame {
public:
MyFrame(wxWindow* parent);
};
class MyApp:public wxApp {
public:
bool OnInit() {
wxFrame* frame=new MyFrame(NULL);
SetTopWindow(frame);
frame->Show();
return true;
}
};
DECLARE_APP(MyApp);
IMPLEMENT_APP(MyApp);
MyFrame::MyFrame(wxWindow* parent):wxFrame(parent,wxID_ANY,_("StatBoxMWE"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_FRAME_STYLE) {
SetClientSize(wxSize(100,100));
wxBoxSizer* mainSizer=new wxBoxSizer(wxVERTICAL);
wxCheckBox* cb=new wxCheckBox(this,wxID_ANY,_("checkbox"),wxDefaultPosition,wxDefaultSize,wxALIGN_LEFT);
wxStaticBox* sb=new wxStaticBox(this,wxID_STATIC,cb);
wxStaticBoxSizer *sbs=new wxStaticBoxSizer(sb,wxVERTICAL);
wxStaticText* text=new wxStaticText(sb,wxID_ANY,_("hello"),wxDefaultPosition,wxDefaultSize,wxALIGN_LEFT);
sbs->Add(text,0,wxALL,5);
mainSizer->Add(sbs,1,wxEXPAND|wxALL,10);
SetSizer(mainSizer);
}
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
As I wrote on the forums, the issue can be reproduced with the unmodified widgets sample:
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Yes, I can see this, thanks. Will try to debug.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Copying parts of the static box to wxPaintDC
used wrong coordinates, fixed now and this will have to be applied to 3.2.
However in master we actually shouldn't use the custom paint code for wxStaticBox
at all, i.e. do as if msw.staticbox.optimized-paint
system option were always set to 0 because it's fine to let the control paint itself there because there is no flicker when using WS_EX_COMPOSITED
. Unfortunately we still need to keep all this code just in case we need to change the label colour, but we can at least avoid using it by default. And maybe we can still get rid of it.
Anyhow, I've done all this in #22952 now, please test it and let me know if you see any new problems with it (the original one should be fixed).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Many thanks, vadz.
I'm not really familiar with how Github works, but am willing to learn.
What's the correct way to test your commits? Should I download and compile the msw-statbox-paint branch, and test the widgets example locally?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Yes, please get the branch (you can use git fetch https://github.com/vadz/wxWidgets.git && git switch msw-statbox-paint
if your Git is not too ancient) and build the library from it -- and then build either the sample or, even better, your application using this version. TIA!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
The git command you suggested cloned the repo but then said invalid reference for the branch. (I'm on the latest version of git.) Nevermind, I eventually figured out git clone --recurse-submodules --branch msw-statbox-paint https://github.com/vadz/wxWidgets.git
and it seemed to work okay.
Unfortunately, compiling failed with the error:
../src/msw/statbox.cpp: In member function 'virtual bool wxStaticBox::SetForegroundColour(const wxCo
lour&)':
../src/msw/statbox.cpp:231:26: error: expected type-specifier before 'wxStaticText'
m_labelWin = new wxStaticText(this, wxID_ANY, GetLabel());
^~~~~~~~~~~~
make: *** [Makefile:29170: corelib_msw_statbox.o] Error 1
I checked and statbox.cpp didn't include "#include "wx/stattext.h"
. I added it to line 34 and this seemed to resolve the issue as it then compiled.
I then compiled the widgets sample and my own application, and the staticbox with checkbox now both look fine.
It looks like your commits do indeed solve the problem (the minor issue above notwithstanding).
Thank you!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Sorry for the compilation problem, I've fixed this issue in the branch but apparently after you had fetched it. And glad to hear that it works for you, thanks for testing!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Closed #22940 as completed via 1c2ec47.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.
Forgot to mention it, but this was already applied to 3.2 in 5c39d04
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.