Search found 7 matches

by quanzhuo
Fri May 07, 2021 10:10 am
Forum: C++ Development
Topic: Custom control is not drawn correctly when I resize the frame
Replies: 2
Views: 592

Re: Custom control is not drawn correctly when I resize the frame

Such issues are usually avoided by creating the control with style flag wxFULL_REPAINT_ON_RESIZE. Your screenshot looks a bit odd though but trying it should not hurt. BTW, you should actually implement Create() which is used together with the default ctor in two-step creation. It worked ! Thank you
by quanzhuo
Fri May 07, 2021 7:03 am
Forum: C++ Development
Topic: Custom control is not drawn correctly when I resize the frame
Replies: 2
Views: 592

Custom control is not drawn correctly when I resize the frame

Hi, guys: I create a custom control which Inherited wxWindow. the control works ok when I first show it in frame: https://i.postimg.cc/h45QJH5J/ok.png However, if I resize the frame, the custom button display incorrectly https://i.postimg.cc/C165qqmy/bad.png note the text is not center in button, an...
by quanzhuo
Thu May 06, 2021 8:38 am
Forum: C++ Development
Topic: Layout using sizer not function as expected
Replies: 3
Views: 934

Re: Layout using sizer not function as expected

That code used to work until 3.1.4, so it's probably a bug. Instead of sizer->SetSizeHints(this); use this for now (this is what SetSizeHints() used to do): const wxSize clientSize = sizer->ComputeFittingClientSize(this); this->SetMinClientSize(clientSize); this->SetClientSize(clientSize); oh oh oh...
by quanzhuo
Thu May 06, 2021 1:49 am
Forum: C++ Development
Topic: Layout using sizer not function as expected
Replies: 3
Views: 934

Layout using sizer not function as expected

Hi, guys: I create a simple wxFrame based App, place a wxPanel on wxFrame, and then add a sizer and a button. the result layout is https://i.postimg.cc/DykKyZcK/bad.png The frame is much larger than the button. How can I make the frame fit to the button's size ? What I expected is something like thi...
by quanzhuo
Wed Nov 11, 2020 12:45 am
Forum: C++ Development
Topic: My Frame don't fit to content
Replies: 6
Views: 350

Re: My Frame don't fit to content

Hi, Did you set any constraints on the frame? Did you pass any size parameter to its constructor? Thank you. Yes, I have set needed constraints. Maybe the reason is like what @doublemax said: wxDataViewCtrl does not implement the "best size" calculation needed for the sizer. I need set a minimum si...
by quanzhuo
Wed Nov 11, 2020 12:41 am
Forum: C++ Development
Topic: My Frame don't fit to content
Replies: 6
Views: 350

Re: My Frame don't fit to content

doublemax wrote:
Tue Nov 10, 2020 6:28 pm
wxDataViewCtrl does not implement the "best size" calculation needed for the sizer. So it's basically ignored by the sizer layout. You'll need to set a reasonable minimum size for the wxDataViewCtrl yourself (SetMinSize()).
You explained my confusion
Thank you
by quanzhuo
Tue Nov 10, 2020 10:41 am
Forum: C++ Development
Topic: My Frame don't fit to content
Replies: 6
Views: 350

My Frame don't fit to content

Hi, All: I placed a panel on wxframe, then add some controls through sizers, but the frame don't fit to the mininal required size of the panel, the code : HelperFrame::HelperFrame(const wxString &title) : wxFrame(nullptr, wxID_ANY, title), index(1) { wxPanel *panel = new wxPanel(this, wxID_ANY); wxS...