Home » U++ Library support » TopWindow&PopUp, TrayIcon » how to communicate between windows?
Re: how to communicate between windows? [message #29594 is a reply to message #29591] |
Tue, 02 November 2010 11:29 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
Is this a threading problem?
How about a simple event interface:
class EventHandler
{
private:
static Vector<EventHandler *> clients;
public:
typedef enum { SOME_EVENT, ANOTHER_EVENT } EventType;
public:
EventHandler() {
clients.Add(this);
}
virtual ~EventHandler() {
for (int i = 0; i < clients.Getcount(); i++)
if (clients[i] == this) {
clients[i].Remove(i);
return;
}
}
static void SendEvent(EventType event, int param1)
{
for (int i = 0; i < clients.GetCount(); i++)
clients[i]->HandleEvent(event, param1);
}
virtual void HandleEvent(EventType event, int param1) { }
};
Any class that inherits from EventHandler would be able to recieve global events.
[Updated on: Tue, 02 November 2010 12:43] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Thu May 16 23:56:59 CEST 2024
Total time taken to generate the page: 0.02779 seconds
|