I’m looking a way to report something specific in status bar of a canvas, while
i’m hesitating to create a new class inheriting from TCanvas.
I would be nice if in a function connected to canvas by Connect or AddExec
would be possible to do something like
void stbar(TCanvas *c1)
// show status bar
// gui implementation of the canvas
TRootCanvas *rc = (TRootCanvas*)c1->GetCanvasImp();
// get pointer to canvas's status bar
TGStatusBar *bar = rc->GetStatusBar();
// add a new part to the status bar
// Put some text into the new part (numbering starts from 0)
bar->SetText("Hello world!", 4);
Perfect, this allows to add additional part to the status bar,
but what to do if i need to change the structure of the bar completely?
“completely” to what degree? Four parts of TCanvas status bar are in use.
Completely means completely.
I want to switch off code in TCanvas::DrawEventStatus and
use status bar in completely different way including different number of parts
(less then 4 as in default canvas)
I suppose that will break TCanvas.
Probably, you need to use TRootEmbeddedCanvas and TGStatusBar classes.
Please find attached an example that does what Valeriy suggested - it creates an embeded canvas and a status bar as one TCanvas has. I have commented the code of lines 103 and 105 and wrote another text for 1st and 2nd fields of the status bar, leaving 3rd and 4th to display the same information as event status bar of canvas.