TPad::Update() vs. TPad::Modified()

Dear Root Talk,

in the User’s Guide for ROOT 5.08 (p.28 ) it says you can update a canvas in one of three ways:

  1. enter a carriage return in the ROOT command line
  2. click inside of the pad
  3. call TPad::Update()

Of those only the second method works for me, unless I call TPad::Modified(). Then it will update the pad - no need to follow it with TPad::Update() as I found here

Is this normal, or am I just doing it incorrectly.

Say I have a canvas c1 with a histogram on it. If I do the following

root[ ] c1->SetGridx()
root[ ] c1->Update()

is this supposed to update the canvas to show the x-axis gridlines?

If I do

root[ ] c1->SetGridx()
root[ ] c1->Modified()

it updates the canvas - no need to c1->Update().

Thanks for the help :slight_smile:


The text you pointed is related to histogram drawing. This text has not been changed since years.

The call of Modified() method says that there is something new to be drown in a pad, the call of c1->Update() will check for every pad in the canvas is it was modified and will redraw only the modified pads. In your example, SetGridx changes a pad attribute and calling Modified method puts that attribute on place. Is there particular reason why calling c1-Update() does not draw the grid I do not know and I hope someone else will explain that to you.

Cheers, Ilka


The TPad::SetGrid functions do not call TPad::Modified.
The user has to call this function followed by TPad::Update.
We should change this behaviour to call Modified from all the TPad
functions like SetGrid changing the pad status.


Hi Rene,
My posting says:[quote]In your example, SetGridx changes a pad attribute and calling Modified method puts that attribute on place. [/quote]what was a comment for the following lines:root[ ] c1->SetGridx() root[ ] c1->Modified() provided by the user. I know that SetGridx/y do not call Modified() method, but I have no idea why.
Cheers, ilka

I have made trivial changes to TPad such that calling functions like SetGrid, SetLogx, SetTheta will automatically trigger a call to TPad::Modified


Thanks for the prompt replies - I only got a notification email today.

I am still a little confused.

Reading Rene’s first post it appears I would need to call Modified() and then Update(). But I don’t need to call Update(), just Modified() and the grid lines appear on the pad.

So does this mean that everything out of TPad:: will need to be followed by a Modified() instead?

Also, the carriage return updating is no longer valid apparently?


With your version of ROOT:
-if you are typing commands, do

-if you are in s script, do

In the first case, mypad->Update is automatically called when typing CR
In the second case, you need to call Update only to force the generation of some objects (like the “stats” box) in case you want to access
this object before teh end of teh script.
See Users Guide.