However when I move the window the new title disappear. My assumption is that when moving object are redrawn and as I set “gStyle->SetOptTitle(0)”. The pt doest not exists anymore, and ptn seems to be also deleted for some reason. Is this understanding correct ?
How should I handle this to avoid the title to disappear ?
I am not sure I understand what you are doing. It seems you simply want to change the histogram title ? … why are you doing something that complicated ? The TPaveText is created when the histogram is drawn you cannot “detach” it … What is the use case of a such exercise ?
Hi, I use and reuse an histogram in multiple canvas as comparison reference.
It already happened for some reasons that the title is updating by itself due to graphics update and got confused by that. I prefer to have a dedicated title without any ambiguity and put the histogram title one for all instead of changing it as many times I need to draw a TPad.
Additionally, I also got confusions while drawing the legend.
So after getting the TPaveText I can just clone it as many time as I want and keep same position and style.
Btw, I think this title should not be a feature of the histogram/graph/etc…, but rather TVirtualPad.
However I understand it makes simpler when one is using h->Draw();
This I do not understand. The histogram title is fixed unless it is changed by SetTitle. Do you have some macro reproducing this uncontrolled title change ?