I need to show the value of the graphs and histogram with the mouse. I need to select a point of the graph or histogram with the mouse and display it in a label or in a tooltip (the best way).
How is possible to do this?
What you request is alraedy implemented.
In the canvas menu bar, activate the “Event Status”.
When moving the mouse on top of an object, you will see more information about this object.
root.cern.ch/root/htmldoc/TObjec … ObjectInfo
Thank you Rene, but I’m developing my application as a standalone application, that it means that I compile the code. For this reason I don’t have the canvas menu, because I use TRootEmbeddedCanvas.
Do you have another solution?
This is also possible with a TRootEmbeddedCanvas. See example in $ROOTSYS/test/RootShower
Thank you. But the example is related to a GeoManager, where the data to display in the status bar are present in a list of events. But I use TGraph and histograms.
Do you have another example?
Maybe I can found another example in the code of TCanvas. Is it correct?
Implement the GetObjectInfo function.
This should be straightforward.
see for example TF1::GetObjectinfo at;
root.cern.ch/root/htmldoc/src/TF … ObjectInfo
Thank you Rene, but this means that I need to rewrite all the GetObjectInfo of all the object that I would like to use into my TRootEmbeddedCanvas.
But I can try to explain what is my purpose. I have a TGMainFrame with a TGStatusBar divided into 4 parts.
I would like to create some TGRootEmbeddedCanvas into this main frame and, enabling the Event Status (with a call to the TCanvas::ToggleEventStatus()) I would like to display the same information displayed in a TCanvas within a root cint session (and with Event Status enabled from menu).
I have studied the code of TRootCanvas, TCanvas and TCanvasImp. I have seen that TCanvas::DrawEventStatus() use TCanvasImp::SetStatusText().
I think that if my main frame is also a TCanvasImp, with the SetStatusText() implemented
it is possible to use the TCanvas::DrawEventStatus() to write into my status bar. But I don’t know how is possible to set the TCanvas::fCanvasImp attribute of the canvas created with the TRootEmbeddedCanvas.
Is there a solution?
Thank you very much
I have had the same problem, but found a workaround for it. I just wrote my own Canvas (class MyCanvas, attached to this post).
MyCanvas is a TGMainFrame with a TGStatusBar and a TRootEmbeddedCanvas containing a TCanvas. The Signals that are emitted by the Canvas inside the EmbeddedCanvas are displayed in the StatusBar the same way TCanvas does it. It cannot be closed by the x-button on the right top corner. But this is easy to change.
(it ads one more functionality: When you delete the Class it remembers its position and size and stores it to agat.ini (use whatever you like here) and if you open it again it reads back those values. )
Hope that helps,