Hi David,
like Valeriy Onuchin already said in his reply, this is very easy with
the Qt like signal/slots mechanism we have recently introduced in ROOT.
Currently this facility is only available in the development version of
ROOT in CVS. To read more about signal/slot in ROOT see see
http://root.cern.ch/root/HowtoSignalSlot.html.
For example what you want can be achieved with the little macro below:
//-- close.C
void close()
{
TCanvas *c = new TCanvas();
TRootCanvas *rc = (TRootCanvas*)c->GetCanvasImp();
rc->Connect("CloseWindow()", 0, 0, "monitorClose()");
}
void monitorClose()
{
printf("canvas closed\n");
}
Cheers, Fons.
David Faden wrote:
>
> Hi,
> Is there a way to specify a chunk of code to be executed when
> a TCanvas (or GUI window) is closed? Is it possible to do this under
> interpretted code without blocking without polling -- something akin to
> TPad::AddExec(char*, char*)?
> Does the number returned by TCanvas::GetCanvasID() have any utitility
> if the TCanvas is not embedded?
> Thank you.
>
> David
--
Org: CERN, European Laboratory for Particle Physics.
Mail: 1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch Phone: +41 22 7679248
WWW: http://root.cern.ch/~rdm/ Fax: +41 22 7677910
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:36 MET