Hello
In WxSmith Tutorial 6 ( http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Accessing_items_in_resource#Using_value_from_wxSlider_to_change_font_size (http://wiki.codeblocks.org/index.php?title=WxSmith_tutorial:_Accessing_items_in_resource#Using_value_from_wxSlider_to_change_font_size)) the following code causes Tutorial6.exe to crash:
void Tutorial6Frame::OnSlider1CmdScrollThumbRelease(wxScrollEvent& event)
{
Layout();
GetSizer()->SetSizeHints(this);
}
As soon as I remove GetSizer()->SetSizeHints(this);, everything works fine.
I have WxWidgets 2.8 and C::B 8.02 with MinGW 5.1.6 on WindowsXP Pro (32), SP2
Any idea why?
[attachment deleted by admin]
There are several minor versions of wxWidgets 2.8, that are not fully compatible.
But I don't think this is the problem.
Are you sure you GetSizer() returns a valid pointer ?
wxWindow::GetSizer
wxSizer * GetSizer() const
Return the sizer associated with the window by a previous call to SetSizer() or NULL.
You can try something like:
if (GetSizer()) GetSizer()->SetSizeHints(this);
and see whether the error still occurs or not.
Thank you very much Jens
Your solution stopped the crash, but I suspect the code isn't working as intended:
void Tutorial_6Frame::OnSlider1CmdScrollThumbRelease(wxScrollEvent& event)
{
Layout();
GetSizer()->SetSizeHints(this);
}
(as given in the tutorial)
In the first line we adopt positions of items to new environment just like in case of changing label in wxStaticText. In the second line we recalculate minimal size of the window making sure that all items will have enough space.
It seems that it should let the window grow to make space for the overgrown label, but that doesn't happen. I assume GetSizer() returned false...
Could you please point me to the wxWidgets documentation. I have only found the tutorials.
Greetings from Innsbruck
[attachment deleted by admin]