Author Topic: wxWidgets Tutorial 8: Expandable box is clipped  (Read 226 times)

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 24
wxWidgets Tutorial 8: Expandable box is clipped
« on: September 16, 2017, 01:20:02 am »
I did wxWidgets Tutorial 8 at:
http://wiki.codeblocks.org/index.php/WxSmith_tutorial:_Drawing_on_the_Screen_and_Saving_Drawings

The result of the Expandable Graph part of this tutorial is shown in the attached image. The red box outlined in green does expand when the window is resized in accordance with this the goal of this part of the tutorial. But it is in a light gray background that does not. When the window is expanded enough this light gray background clips the box as the attached image shows. What is this light gray background? How can it be made to expand with the window?

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1520
Re: wxWidgets Tutorial 8: Expandable box is clipped
« Reply #1 on: September 16, 2017, 03:35:24 pm »
This kind of question are better asked on a wxWidgets forum, because this are wxWidgets related and not wxSmith or codeblocks related.

I did not read the tutorial, but i think the gray color is the default window background and you see it because you do not paint on it. So your calculation of the canvas is probably wrong...

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1520
Re: wxWidgets Tutorial 8: Expandable box is clipped
« Reply #2 on: September 16, 2017, 03:37:51 pm »
Have you looked at this: from the tutorial
Quote
Be sure to click the Expand property.

it could also be possible that the frame does not get expanded and so your canvas does not expand with the window... Without code it is hard to tell.

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 24
Re: wxWidgets Tutorial 8: Expandable box is clipped
« Reply #3 on: September 16, 2017, 08:00:33 pm »
The Expand property's checkbox is checked for both panels. The project is attached.

Offline BlueHazzard

  • Lives here!
  • ****
  • Posts: 1520
Re: wxWidgets Tutorial 8: Expandable box is clipped
« Reply #4 on: September 17, 2017, 01:36:02 am »
Your application crashed after the resize event. So it never gets repainted and for this you get this behavior (also from your other post).
I do not know exactly why it crashes (i am not this familiar with wxWidgets), but a fix is to remove the inner sizer. I think because the inner sizer has no child it can not calculate the minimal size (or perform any resizing operation) and for this it crashes (some invalid pointer to the non existent child window (only assumption, no knowledge, this is outside from the scope of this forum))...
If you remove the inner sizer all works as expected and you don't get any crash...

The layout of NewFrame:
+ NewFrame
   - wxFrame
      - wxBoxSizer: BoxSizer1
         - wxPanel: Panel1