the wxPanels color changes only when the window is minimized Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Hossein
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Sep 21, 2008 7:23 am
Location: Somwhere nearby...
Contact:

the wxPanels color changes only when the window is minimized

Post by Hossein » Wed Feb 11, 2009 5:50 pm

hello, i wrote a simple function to change the color of the wxPanle of my application .
the problem is whenever the user changes its color, in order to see the new color , he must minimize the whole application and then when restore it ,by doing this the panels color is changed .(wxpanel color changer works only when the window is minimized and then restored, if you dont minimize or maximize the window , you cant see the new color)
i attached the exe file , so that you can see it yourself
----------
i also made the same function for the TextControl! when the problem is, in order to see the effect( new color)! the user must click on the text control ,without doing so the color wont change!
how can i get the instant change of color ?

Code: Select all

void _2Frame::ChangePanelColor(wxCommandEvent& event)
{
         wxColour OldColour = Panel1->GetBackgroundColour();
        wxColour NewColour = wxGetColourFromUser(this,OldColour);

    if ( NewColour.IsOk() )
    {
        Panel1->SetBackgroundColour(NewColour);
    }
}

void _2Frame::OnButton3Click(wxCommandEvent& event)
{
        wxColour OldColour = TextCtrl1->GetForegroundColour();
        wxColour NewColour = wxGetColourFromUser(this,OldColour);

    if ( NewColour.IsOk() )
    {
        TextCtrl1->SetForegroundColour(NewColour);
    }

} 
Attachments
12.zip
wxpanel color changer works only when the window is minimized and then restored
(138.84 KiB) Downloaded 19 times
Add-on Components (90)
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)

http://www.wxcommunity.com/

User avatar
Disch
Experienced Solver
Experienced Solver
Posts: 99
Joined: Wed Oct 17, 2007 2:01 am

Post by Disch » Wed Feb 11, 2009 6:00 pm

Try calling Panel1->Refresh(); after you change the background color.

Hossein
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Sep 21, 2008 7:23 am
Location: Somwhere nearby...
Contact:

Post by Hossein » Wed Feb 11, 2009 6:04 pm

Thanks its solved ! :)
Add-on Components (90)
Applications (183)
Development Tools (27)
Icons and Resources (1)
Sample Code and Project Templates (10)
Utilities (4)
wxWidgets (10)

http://www.wxcommunity.com/

Post Reply