AW: [ROOT] unable to run a gui (fwd)

From: Hemberger Dr. Marc (M.Hemberger@gsi.de)
Date: Wed May 24 2000 - 10:09:13 MEST


Hi Olivier,

this could be a chance to advertise once again the usage of TThreads
together with a GUI ;-) 

We had the same problem and solved it by using threads. When we request
events from an event stream and want to have the resulting histogram drawn
on a canvas, we are obliged to wait, until the system returns from the
request and the canvas update is done. 

But what happens, if the request stops, no events are coming etc.? The GUI
is blocked for ever. So we put the event request into a thread and from now
on the GUI runs asynchronous to the event request. The canvas update can
then be performed by another thread or a timer.

For details, please read

http://www-linux.gsi.de/~go4/HOWTOthreads/

If you need more info, don't hesitate to contact us.

I admit, that the usage of TThreads is not very intuitive and probably in
this case like shooting on birds with canonballs. Another solution could be
the usage of timers, both for the event request and the canvas update.
Probably more intuitive for scientists ...

Greetings,

Marc
-----Ursprüngliche Nachricht-----
Von: Olivier D'Arcy [mailto:darcy@ligo.mit.edu]
Gesendet: Dienstag, 23. Mai 2000 23:12
An: roottalk@pcroot.cern.ch
Betreff: [ROOT] unable to run a gui (fwd)




---------- Forwarded message ----------
Date: Tue, 23 May 2000 16:55:19 -0400 (EDT)
From: Olivier D'Arcy <darcy@ligo.mit.edu>
To: julien@ligo.mit.edu
Subject: unable to run a gui

I have written a Mymainframe class derived from TGMainframe in order to
create a gui with plots and window. Then in my main function, I create a
Mymainframe object with the new function. After the frame is created I
would like to launch an infinite loop that updates the plots in realtime
by reading 
datafiles. But the problem is that the frame itself only appears on the
screen  when the main returns, so the infinite loop is tryibg to update my
plots before the plots are first drawn. Since I want  an infinite loop, I
need to make my frame appear first and then start the update_loop()
method. 

this is how my code looks like:

main()
{
	myframe = new Mymainframe(..., gClient->GetRoot(), 500, 500, ...);
	update_loop(filename...);
}

Can somebody help with this?



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:26 MET