gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] layout managers


From: Horst Herb
Subject: Re: [Gnumed-devel] layout managers
Date: Sun, 25 Jul 2004 23:30:25 +1000
User-agent: KMail/1.6.2

On Sun, 25 Jul 2004 22:40, Ian Haywood wrote:
> > a) the problem isn't the user coping with blank fields but
> >    rather the widget code continually having to check for
> >    patient existence unless we adopt the hard-and-fast rule
> >    "if I am visible I DO have a patient"
>
> As far as I understood, this was what Horst was talking about --
> when EVT_PAINT is received, the widget reconciles business layer reality
> with its display, whether that's no patient, new patient or new data from
> the backend.

Yes, and it's really so simple:

1.) Initially, the widget is in the "blank" state = all data GUI elements are 
in their default state
2.) Whatever widget is used to select/enter a patient, emits a 
"PatientChanged" message
3.) All widgets depending on the active patient receive the message and:
        a) check whether the "new" patient is "their current" patient
        aa) if not, they flag themselves as "need_update"
        b) do a self._refresh()
        bb: self._refresh() checks whether the widget is currently visible.
        bbb: if visible, it updates itself from the backend / business objects 
and 
sets need_update to false
        bbbb: if not visible, it leaves the need_update flag set
4.) if the widget receives a EVT_PAINT, it
        a) checks whether need_update is true
        aa) if so, it updates itself from the backend/business object and sets 
need_update to false
        b) else it simply returns

pseudo code:

def OnEvtPaint(self, evt):
        self._update()          

def OnPatientChanged(self, id):
        if self._id == id: 
                return
        self._id = id
        self._need_update = 1
        if self.visible(): # e.g,. check wx.Window.IsShown()
                self._update()

def _update(self):
        if (! self._need_update):
                return
        .... do update stuff ...


It's really that simple.
Horst   




reply via email to

[Prev in Thread] Current Thread [Next in Thread]