Author Topic: wxSmith Wiki: possible flaw  (Read 4730 times)

Aganel

  • Guest
wxSmith Wiki: possible flaw
« on: April 18, 2014, 05:51:35 pm »
Greetings!

I'm new here, so please correct me, if i've chosen wrong place to post.

I'm a beginner in wxWidgets, so i've desided not to edit wiki directly, but to ask your advice. Studying the tutorial, i've reached a chapter WxSmith tutorial: Accessing items in resource. There, in the section Using the Value from wxSlider to Change Font Size i noticed that my test program is not working as expected: when one changes font size, the size of the window remains constant while the Panel1 size is dynamic. I double checked my test program for errors and discrepancy between it and wiki and found none. So, after some thinking and googling, i found a solution: adding a line
Code
Panel1->GetSizer()->SetSizeHints(Panel1);
in Tutorial_6Frame::OnSlider1CmdScrollThumbRelease function, so, that the whole function would be like this:
Code
void Tutorial_6Frame::OnSlider1CmdScrollThumbRelease(wxScrollEvent& event)
{
    Layout();
    Panel1->GetSizer()->SetSizeHints(Panel1);
    GetSizer()->SetSizeHints(this);
}
It works, and it works even without Layout(); line, so i wonder if it should be there or not.

So, please, tell me what is the correct listing of the function Tutorial_6Frame::OnSlider1CmdScrollThumbRelease.

(Sorry for my language mistakes, it is not my native.)


UPDATE:
I think i found the place where above mentioned Layout(); is missing. It is in the next section in Tutorial_6Frame::OnButton4Click function, so it should be:
Code
void Tutorial_6Frame::OnButton4Click(wxCommandEvent& event)
{
    wxColour OldColour = StaticText3->GetForegroundColour();
    wxColour NewColour = wxGetColourFromUser(this,OldColour);

    if ( NewColour.IsOk() )
    {
        StaticText3->SetForegroundColour(NewColour);
        Layout();
    }
}
« Last Edit: April 18, 2014, 06:14:39 pm by Aganel »