[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Gnumed-devel] inter-module communication
From: |
Hilmar Berger |
Subject: |
Re: [Gnumed-devel] inter-module communication |
Date: |
Tue, 3 Sep 2002 00:05:43 +0200 (CEST) |
Hi,
On Mon, 2 Sep 2002, Horst Herb wrote:
> 1.) any widget interested in particular data should register it's interest
> via
> gmDispatcher.
> Example: A "person info" widget displaying name & address of the currently
> active patient needs to know when the patient has been changed.
> Thus, it registers it's own callback function (which subsequently updates the
> widget) with gmDispatcher.
> Any widget that changes the current patient, will must notify gmDispatcher,
> who in turn will fire all the registered callback functions.
What about getting the *initial state* of some data ?
Imagine the following case :
Module A controls data X
Module B would like to be notified of changes of X
Module A:
1) init X (set it to some initial state - meaningful or default)
2) send 'X_changed'
...
n) change X
n+1) send 'X_changed'
Module B:
1) connect(callback, 'X_changed')
B's callback : get copy of X
Everything runs fine as long B's callbacks are initialized before X
contains meaningful data. But if B registers the callbacks after X
changes, B has no possibility to get the new state of X until it changes
again.
There are several possible solutions (re-sending messages to newly
registered callbacks by the dispatcher for some time, register a mandatory
callback on the senders side to request data, notification of the
sender of newly arrived receivers, others ?)
Any suggestions which way to go?
Hilmar