Remembering a wxWindow's position and state Re: GetScreenPosition and iconize

Volker Bartheld dr_versaeg at freenet.de
Tue Apr 3 01:29:51 PDT 2007


Hi Vadim!

> VB> The culprit was, that I capture EVT_MOVE in my child windows and forward
> VB> the event to the parent with
> VB> void PassphrasePopup::OnMove(wxMoveEvent& e)
> VB> {
> VB>   GetParent()->AddPendingEvent(e);
> VB> }

> In general it's a bad idea to do things like this so I'd strongly advise
> you to find some other way to do what you want, the above will result in
> [more] problems later.

Of course I can use a custom event for that (Or is it better to derive from
wxMoveEvent? How would I handle those events separately from the standard
wxMoveEvent?), this was just a test and the parent is hidden anyhow.

In the parent, I have the following code, so there shouldn't be that much
interference:

BEGIN_EVENT_TABLE(TheParent, wxWindow)
EVT_MOVE(TheParent::OnMove)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(TheParent, wxWindow)
void TheParent::OnMove(wxMoveEvent& event)
{
  if(event.GetId()==GetId()) { event.Skip(); return; }
  // handle forwarded move event here...
  }

For now this probably won't explode. I just wanted to avoid the hassle of
having to code the coordinates in wxCommandEvent's wxString or int member
and then extract them in the parent again...

Cheers,
Volker

-- 
mailto:  V B A R T H E L D at G M X dot D E






More information about the wx-users mailing list