After some struggeling on how to set the framework for a online monitoring
system (LHCb Outer Tracker testbeam), I have come to the conclusion that I
should make it event-driven. First I had a sort of run loop updating all
the displays and histograms and then a seperate call to look for GUI
events. Now I want a run loop also to be a sort of event, with each
loop called by a specialed timer class.
I have the following idea, but I'm not sure if this is the appropriate way
to use the GUI classes, or that it's already implemented in another way in
ROOT. So please give comments/advise.
The idea is to make a Timer class (OTGMsgTimer) which generates a message
and send this message to some controlling object. The framework provided
by ROOT suggests the following; The TTimer should be a sort of TGWidget
(to know where to send the message to, and to have an id of the timer).
Because I want to use the TGFrame::SendMessage(...) functionmember it
should also be a TGFrame. And ofcourse it will be a TTimer.
The OTGMsgTimer::Notify() functionmember would look something like this:
----------
Bool_t OTMsgTimer::Notify() {
// Notify when OTMsgTimer times out. The OTMsgTimer checks for GUI
events
//
SendMessage(fMsgWindow, MK_MSG(kC_???, k??_???), fWidgetId,
(Long_t) fUserData);
Reset();
return TTimer::Notify();
}
----------
So in the above mentioned monitoring code I would have the OTMsgTimer send
a message to a controlling object (OTRunController) which performs a run
loop when it recieves the message.
The problems I encounter:
- I nead new message type (EWidgetMessageTypes in TGWdiget)
- I could implement this by using kC_MSGMAX.
- OTGMsgTimer will be a TGFrame (to use SendMessage(...) which it surrely
is not. (The X,Y position of a timer?)
- or more general: I will use a graphics interface to implement event
driven code. Is this the way I should use it, or is a reason not to?
Bye, Rutger van der Eijk
p.s. I am still waiting on a reply on my roottalk message of last
thursday.