This macro gives an example of how to create a status bar related to an embedded canvas that shows the info of the selected object, exactly as the status bar of any canvas window.
private:
public:
virtual ~MyMainFrame();
void DoExit();
void DoDraw();
void SetStatusText(
const char *txt,
Int_t pi);
};
void MyMainFrame::DoDraw()
{
printf(
" i %i %f %f \n",i,
x[i],
y[i]);
}
c1->GetFrame()->SetFillColor(21);
c1->GetFrame()->SetBorderSize(12);
}
void MyMainFrame::DoExit()
{
printf("Exit application...");
}
void MyMainFrame::SetStatusText(
const char *txt,
Int_t pi)
{
fStatusBar->SetText(txt,
pi);
}
{
const char *text0, *text1, *text3;
char text2[50];
SetStatusText(text0,0);
SetStatusText(text1,1);
sprintf(text2, "%c", (char) px);
else
sprintf(text2, "%d,%d", px, py);
SetStatusText(text2,2);
SetStatusText(text3,3);
}
{
Int_t wid = fEcan->GetCanvasWindowId();
fEcan->AdoptCanvas(myc);
myc->
Connect(
"ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
"MyMainFrame",
this,
"EventInfo(Int_t,Int_t,Int_t,TObject*)");
Int_t parts[] = {45, 15, 10, 30};
fStatusBar->SetParts(parts, 4);
fStatusBar->Draw3DCorner(
kFALSE);
draw->
Connect(
"Clicked()",
"MyMainFrame",
this,
"DoDraw()");
exit->
Connect(
"Pressed()",
"MyMainFrame",
this,
"DoExit()");
SetWindowName("Embedded Canvas Status Info");
MapSubwindows();
Resize(GetDefaultSize());
MapWindow();
}
MyMainFrame::~MyMainFrame()
{
Cleanup();
delete fEcan;
}
void statusBar()
{
new MyMainFrame(
gClient->GetRoot(), 200, 200);
}
#define ClassDef(name, id)
R__EXTERN TApplication * gApplication
void Printf(const char *fmt,...)
virtual void Terminate(Int_t status=0)
Terminate the application by call TSystem::Exit() unless application has been told to return from Run...
virtual void SetLineWidth(Width_t lwidth)
Set the line width.
virtual void SetLineColor(Color_t lcolor)
Set the line color.
virtual void SetMarkerColor(Color_t mcolor=1)
Set the marker color.
virtual void SetMarkerStyle(Style_t mstyle=1)
Set the marker style.
virtual void AddFrame(TGFrame *f, TGLayoutHints *l=0)
Add frame to the composite frame using the specified layout hints.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetTitle(const char *title="")
Change (i.e.
virtual void Draw(Option_t *chopt="")
Draw this graph with its current attributes.
TAxis * GetXaxis() const
Get x axis of the graph.
TAxis * GetYaxis() const
Get y axis of the graph.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
virtual char * GetObjectInfo(Int_t px, Int_t py) const
Returns string containing info about the object at position (px,py).
virtual const char * GetTitle() const
Returns title of object.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
static constexpr double pi