RE: root GUI

From: Bertrand Bellenot <Bertrand.Bellenot_at_cern.ch>
Date: Thu, 15 Apr 2010 09:59:28 +0200


Hi again,

Sorry, I was wrong, this code is NOT a proper solution:

GCluster::~GCluster()
{
  delete button;
  delete fC;
}

Since GCluster is not the parent frame... Anyway, I'll take a look today and see if there is a simple solution.

Cheers, Bertrand.

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Bertrand Bellenot
Sent: Thursday, April 15, 2010 09:54
To: rl_at_hep.ph.bham.ac.uk
Cc: Rene Brun; roottalk
Subject: RE: [ROOT] root GUI

Hi Roman,

So apparently I was not clear enough in my previous post, sorry about that.
Replacing DeleteWindow() calls with DestroyWindow() is not a solution!

So, just to clarify, this code is WRONG:

GCluster::~GCluster()
{
 //Remove frames
 fC->DestroyWindow();
 ftop->RemoveFrame(fC);
 //delete fC;
 button->DestroyWindow();
 ftop->RemoveFrame(button);
 //delete button;
}

...

void MyMainFrame::AddExit()
{
  if(exit) {
    exit->DestroyWindow();
    fMain->RemoveFrame(exit);
    //delete exit;
  }
  exit = new TGTextButton(fMain,"&Exit","gApplication->Terminate(0)");   fMain->AddFrame(exit, new TGLayoutHints(kLHintsCenterX,5,5,3,4)); }

You MUST NOT CALL "DeleteWindow()" or "DestroyWindow()" on GUI Widgets!!!
Please take a look in the examples in $(ROOTSYS)/tutorials/gui

The code above should look like this:

GCluster::~GCluster()
{
  delete button;
  delete fC;
}

void MyMainFrame::AddExit()
{
  if(exit) {
    fMain->RemoveFrame(exit);
    delete exit;
  }
  exit = new TGTextButton(fMain,"&Exit","gApplication->Terminate(0)");   fMain->AddFrame(exit, new TGLayoutHints(kLHintsCenterX,5,5,3,4)); }

And please send me a WORKING piece of code (your code crashes on all platforms) with a proper makefile (yours doesn't generates the dictionary)
Could you also tell me which ROOT version, which platform, and which compiler you are using?

Cheers, Bertrand.

-----Original Message-----
From: Roman Lietava [mailto:rl_at_hep.ph.bham.ac.uk] Sent: Wednesday, April 14, 2010 23:46
To: Bertrand Bellenot
Cc: Rene Brun; roottalk
Subject: RE: [ROOT] root GUI

Hi Bertrand,
thanks for suggestions, I've used them.
Code behaves now a bit better.
But crashes when I want to add third window (second is ok). Also windows resizing is not perfect.
Please, have a look.
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 Thu Apr 15 2010 - 09:59:32 CEST

This archive was generated by hypermail 2.2.0 : Thu Apr 15 2010 - 17:50:01 CEST