Re: questions about TCanvas editor

From: Ilka Antcheva <Ilka.Antcheva_at_cern.ch>
Date: Fri, 12 Jan 2007 16:50:49 +0100


Hi Tom,

Please find my comments/answers below.

> I want to make some small modifications to the editor that appears
> when you select View/Editor in a canvas containing a TH1D:
>
> a) have the canvas initially appear with the editor visible (or
> within a few milliseconds)

Any created canvas will be shown with the editor if you have a .rootrc file in your working directory containing the the line: Canvas.ShowEditor: true
> b) have the histogram selected

Write the following line in your macro as the last one: canvas->Selected(parent_pad_of_histogram, histogram,1); The first parameter may be the canvas itself or the pad containing the histogram object.

> c) modify the editor for TH1-s: remove the Binning tab and replace
> it with one or two of my own tabs

You can add a new tab or use the method fGedEditor->GetEditorTab("Binning") to get the container of the Binning tab and you could change its contents. I presume that your class derives from TH1/2Editors.

> d) my new tab will include a "lock" checkbox that is initially checked,
> and when checked will always keep the histogram selected
>
> The documents are rather old and do not mention anything about this
> editor. At present I do not even know where to look. before I dive
> into the code I'm hoping someone can give me at least a hint of how it
> works, where its code is located, etc.
There is a chapter in the ROOT User's Guide about the editor. Please have a look at ftp://root.cern.ch/root/doc/chapter26.pdf (page 412).

> The purpose of the above modifications is to improve the user
> experience for users of my Root-based application that are unfamiliar
> with root (e.g. it is disconcerting for some other object to
> inadvertently get selected when one is trying to edit the histogram
> style).
>
> Questions:
> A) where is the editor located (i.e. what is its class name)?
TGedEditor is the class name of the ROOT graphics editor . The object editors follow the naming convention as explained in the User's Guide. All files are located in $ROOTSYS/ged directory and form libGed library.
> B) how does it get associated with an object in the canvas?
The graphics editor TGedEditor activates the corresponding object editors according to the selected object in the canvas. An object became selected agter the user click on it using the left-mouse button.
> C) How does it arrange so that when the editor appears, the
> original Pad remains the only pad in the canvas? Or at least,
> doing canvas->cd() and then TH1D::Draw() will re-draw the
> histogram with or without the editor visible. (I would have
> guessed that the editor creates a new pad, which would have
> made that not work).

I am afraid, I do not understand that point... Have you seen some pad disappearing from the canvas at the moment the editor shows up? A more concrete example might help to understand better what did you mean.

Cheers, Ilka Received on Fri Jan 12 2007 - 16:54:14 CET

This archive was generated by hypermail 2.2.0 : Sat Jan 13 2007 - 23:50:00 CET