Status bar with TRootEmbeddedCanvas

Dear Rooter,

I want to see x-y coordinate from my histogram. I would like to ask if there is any way to show the status bar of a TRootEmbeddedCanvas, for example:

fCanvas->ToggleToolBar();

Thank you,

peakprogram.C (12.4 KB)

1 Like

May be:

fCanvas->GetCanvas()->ToggleToolBar();]

Hi,

No, only the canvas itself is embedded. but you can create your own and use signal/slots to display information, as it is done in the TRootBrowser:

   TQObject::Connect("TCanvas", "ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",
                     "TRootBrowser", this,
                     "EventInfo(Int_t, Int_t, Int_t, TObject*)");

////////////////////////////////////////////////////////////////////////////////
// Set text in culumn col in status bar

void TRootBrowser::SetStatusText(const char* txt, Int_t col)
{
   fStatusBar->SetText(txt, col);
}

////////////////////////////////////////////////////////////////////////////////
// Display a tooltip with infos about the primitive below the cursor.

void TRootBrowser::EventInfo(Int_t event, Int_t px, Int_t py, TObject *selected)
{
   const Int_t kTMAX=256;
   static char atext[kTMAX];
   if (selected == 0 || event == kMouseLeave) {
      SetStatusText("", 0);
      SetStatusText("", 1);
      SetStatusText("", 2);
      SetStatusText("", 3);
      return;
   }
   SetStatusText(selected->GetTitle(), 0);
   SetStatusText(selected->GetName(), 1);
   if (event == kKeyPress)
      snprintf(atext, kTMAX, "%c", (char) px);
   else
      snprintf(atext, kTMAX, "%d,%d", px, py);
   SetStatusText(atext, 2);
   SetStatusText(selected->GetObjectInfo(px,py), 3);
}

Cheers, Bertrand.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.