wxID_ANY, unique window IDs and handling messages from arbitrary wxWindows

Volker Bartheld dr_versaeg at freenet.de
Tue Oct 24 09:46:32 PDT 2006


Hi!

I hope this is just a bunch of quickie questions. Here we go:

My window manager has to cope with a number of satellite windows, all
inheriting from wxWindow. It doesn't want to bother with assigning a
wxWindowID but later wants to communicate with its child windows. So the
c'tor passes in wxID_ANY and a later GetId() on the instance of the new
window captures the ID. Is this a valid thing to do? Can I assume, this
ID is unique?

The window manager has to handle messages from its satellites. So I run
DECLARE_EVENT_TYPE(wxEVT_SATELLITE, -1)
DEFINE_EVENT_TYPE(wxEVT_SATELLITE)
and use
BEGIN_EVENT_TABLE(WindowManager, wxFrame)
EVT_COMMAND(wxID_ANY, wxEVT_SATELLITE, WindowManager::OnSatelliteEvent)
END_EVENT_TABLE()
(effectively using wxID_ANY as winid in the EVT_COMMAND macro) to
capture events from all possible windows.

This works so far - but is it also the correct approach?

Thanks for insights and many greetings from Munich,
Volker
__
Mail replies to/an V B A R T H E L D at G M X dot D E






More information about the wx-users mailing list