Hi Fons,
in principal yes... What I have is something like:
main()
{
cout << (int)gROOT->IsBatch() << endl;
TGApplication app;
if (gROOT->IsBatch())
gROOT->SetBatch(kFALSE);
new MyTGMainFrame;
app.Run();
}
The global TROOT object is already instantialted when I start this
application (I don't kown why - you may no it better than me). If
DISPLAY is not set correctly gROOT->IsBatch() returns 1 (because the
constructor of TROOT initializes BATCH mode to 1 if DISPLAY is
incorrect. But the constructor of TGApplication 'fixes' the DISPLAY
variable - without resetting the BATCH-mode flag. Now I may have a valid
connection to an X-Server but my application still assumes that we are
running in BATCH mode.
For me this behaviour is not clear...
Best regards,
Thomas.
Fons Rademakers wrote:
> Thomas,
>
> if the DISPLAY variable is incorrect set you now get the
>
> Error in <TGClient::TGClient>: can't open display "bla:0.0", bombing...
>
> message. Do I understand you want to switch to batch mode in case the
> system could not connect to the X server?
>
> Cheers, Fons.
>
>
> On Tue, 2003-10-21 at 14:24, Thomas Bretz wrote:
>
>>Hi,
>>
>>I found out, that if the DISPLAY variable is not correctly set my
>>application crashes. Searching for the reason I realized, that in the
>>main function gROOT is already set. From the constructor of the TROOT I
>>learned, that Batch-mode is enabled if DISPLAY is not set. So I
>>instantiate a TGApplication object afterwards, which sets the DISPLAY
>>variable in case it is not yet set (calling gSystem->SetDisplay) before
>>instantiating a TGClient object. Wouldn't it be a good idea to reset the
>>batch mode in the case setting the display was successfull? Otherwise I
>>have to reset it manually...
>>
>>Best regards,
>>Thomas.
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:16 MET