Guidance
指路人
g.yi.org
Guidance Forums / wxWidgets (wxWindows) in C++ / problems with local variable in OnPaint

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. problems with local variable in OnPaint
#3388
Posted by: 2004-02-17 02:12:44
Hi

I have a problem, which seems very odd to me

I have a class, derived from wxWindow. It has a private bool which is set in the constructor to false.

private:
bool blMyBool;
which is set in a function to true and checked in OnPaint

void MyClass::SetMyBool(bool aBool)
{
    blMyBool=true;
    wxPaintEvent pe;
    OnPaint(pe);//so it works (blMyBool is true)
    Refresh();//so it doesn't work
};

void MyClass::OnPaint(wxPaintEvent& event)
{
  if(MyBool)
         wxMessageBox("MyBool = true");
};
When I call OnPaint directly, the MessageBox appears, but not when I call Refres().
I don`t have much experience with wxWindows ... so I hope somebody here can help me ;)

cu
ernii
Message2. Re: problems with local variable in OnPaint
#3389
Posted by: 2004-02-17 02:21:17
ops

it should look like

void MyClass::OnPaint(wxPaintEvent& event)
{
  if(blMyBool)
         wxMessageBox("blMyBool = true");
};
but that is not the problem ...
Message3. Re: problems with local variable in OnPaint
#3390
Posted by: 2004-02-17 02:29:23
sorry I forget one thing after the other ...

MyClass is derived from wxFrame .... not wxWindow (ok also from wxWindow, since wxFrame is derived from wxWindow but ...)
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2022-12-9  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0