delete ToolBar

Yves Schutz (schutz@ganil.fr)
Fri, 09 Jan 1998 12:19:15 +0100


I have an error while trying to delete a TControllbar. The TControlbar is declared in a macro called test.cc which is execute in
my rootlogon.cc.

Here is my rootlogon.cc

void rootlogon()
{
#include <iostream.h>

// Create the canvas
TCanvas * MyCanevas = new TCanvas("MyCanevas", "WA98 Pb+Pb 95 analysis");
// Produce the main control bar
gROOT->Macro("test.cc");
}

and here comes the macro test.cc :

TControlBar * main_bar = new TControlBar("horizontal","main","main analysis menu");

main_bar->SetNumberOfColumns(1);

main_bar->AddButton("Close","{MyCanevas->Close(); delete main_bar;}","Close this toolbar");

main_bar->Show();
}

by selecting the button Close, I get the following error :

root [0] Error: No symbol main_bar in current scope FILE:/tmp/12940aaa LINE:1
Error: main_bar==NULL cannot delete FILE:/tmp/12940aaa LINE:1
*** Interpreter error recovered ***

Curiously the problem can be solved by changing the declaration in test.cc by :

main_bar = new TControlBar("horizontal","main","main analysis menu");

!!!!

Thanks .... Yves
--
Yves SCHUTZ GANIL (IN2P3 - CNRS) collaboration TAPS http://ganp03.in2p3.fr
GANIL Telephone: (33) 2 31 45 47 01
BP 5027 Fax : (33) 2 31 45 46 65
F-14076 Caen e-mail : mailto:SCHUTZ@IN2P3.FR