Re: root GUI

From: Bertrand Bellenot <bertrand.bellenot_at_cern.ch>
Date: Tue, 13 Apr 2010 21:46:15 +0200


Hi Roman,

I'll check tomorrow on Linux, but I can already tell you that this kind of code:

  if(exit) {
    exit->DeleteWindow();
    delete exit;
  }

Can lead to a segv... Never call the DeleteWindow() method on widgets (e.g. TGButton)
You should do it this way:

  if(exit) {
    fMain->RemoveFrame(exit); //remove it from its parent first!!!     delete exit; // then just delete it
  }

This may already give you some hints and you can already correct this kind of mistake... ;)

Cheers, Bertrand

Roman Lietava wrote:
> Hi Bertrand,
> thanks for your help.
> I've extracted gui part of my code. It is attached.
> It should compile. It has simple text
> interface which simulates creating and deleting
> windows in a similar way as in real code.
> Any advice and suggestions would be appreciated.
> Thanks,
> Roman.
>
>
>
> On Mon, 12 Apr 2010, Bertrand Bellenot wrote:
>
>> Hi Roman,
>>
>>> I try to add/delete/modify windows dynamically,
>>> e.g. when run starts,stop.
>> This should work, as long as you do it right, for example,
>> You should use this method to close a Window: mainwin->CloseWindow()
>>
>>> - is there somewhere example of gui with
>>> similar functionality ?
>> Depends which functionality... You can take a look at examples in
>> $ROOTSYS/tutorials/gui/*.C and at $ROOTSYS/test/guitest
>>
>>> - is there other documentation apart from
>>> ftp://root.cern.ch/root/doc/25WritingGUI.pdf ?
>> No, this is the only available documentation for the time being...
>>
>>> - how can I debug errors a la bad windows ?
>> You can use gdb, and for the meaning of e.g. "XREQ: 40",
>> you can take a look there:
>> http://www.rahul.net/kenton/xproto/xrequests.html
>> XREQ:40 = TranslateCoords
>> Meaning you (the application) try to translate coordinates of a
>> Window which is not valid anymore...
>>
>> If you still have problems, you can send your code (or the relevant
>> part)
>> and we'll take a look...
>>
>> Cheers, Bertrand.
>>
>> -----Original Message-----
>> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch]
>> On Behalf Of Roman Lietava
>> Sent: Monday, April 12, 2010 07:37
>> To: Rene Brun
>> Cc: roottalk
>> Subject: [ROOT] root GUI
>>
>> I am trying to use to write standalone code
>> with root GUI classes (TGxxxx).
>>
>> I try to add/delete/modify windows dynamically,
>> e.g. when run starts,stop.
>>
>> It sometimes works, but quite often it crashes,
>> see output pasted after email.
>>
>> My questions are following:
>>
>> - is there somewhere example of gui with
>> similar functionality ?
>> - is there other documentation apart from
>> ftp://root.cern.ch/root/doc/25WritingGUI.pdf ?
>> - how can I debug errors a la bad windows ?
>>
>> Thanks,
>> Roman.
>>
>>
>> ""
>> Starting DisplaySCAL for run: 113081
>> fInputs=0x9e99ca8
>> Cleanup ok
>> fComp added
>> Warning in <TCanvas::ResizePad>: fRootEmbeddedCanvas19_canvas width
>> changed from 0 to 10
>>
>> Warning in <TCanvas::ResizePad>: fRootEmbeddedCanvas19_canvas height
>> changed from 0 to 10
>>
>> Inputs added
>> run 113081 adding cluster 0
>> Error in <RootX11ErrorHandler>: BadWindow (invalid Window parameter)
>> (XID:
>> 10486057, XREQ: 40)
>> ""
>>
>>
>>
>>
>
Received on Tue Apr 13 2010 - 21:46:49 CEST

This archive was generated by hypermail 2.2.0 : Wed Apr 14 2010 - 05:50:03 CEST