Drawing on controls

Dear ROOTers,

Is there a way to draw on top of GUI controls in ROOT? I have a TGListView that sometimes takes long to fill up from a TTree. Therefore I display it empty and than fill it in a separate thread. I would like to write on top of it a related message, larger and more visible than standard entry. Just painting a red text not taking into account control characteristics. Is it possible? I thought that maybe with TVirtualX, but that seems to paint only in Canvases.

Hi,

No, there is no simple way of doing this. But you can change the cursor to “wait” state, like it is done for example in TGFileBrowser:

[code]//_____________________________________________________________________________
//
// TCursorSwitcher
//
// Helper class used to change the cursor in a method and restore the
// original one when going out of the method scope.
//_____________________________________________________________________________

///////////////////////////////////////////////////////////////////////////////
class TCursorSwitcher {
private:
TGWindow *fW1;
TGWindow *fW2;
public:
TCursorSwitcher(TGWindow *w1, TGWindow *w2) : fW1(w1), fW2(w2) {
if (w1) gVirtualX->SetCursor(w1->GetId(), gVirtualX->CreateCursor(kWatch));
if (w2) gVirtualX->SetCursor(w2->GetId(), gVirtualX->CreateCursor(kWatch));
}
~TCursorSwitcher() {
if (fW1) gVirtualX->SetCursor(fW1->GetId(), gVirtualX->CreateCursor(kPointer));
if (fW2) gVirtualX->SetCursor(fW2->GetId(), gVirtualX->CreateCursor(kPointer));
}
};

[…]

//______________________________________________________________________________
void TGFileBrowser::Refresh(Bool_t /force/)
{
// Refresh content of the list tree.

TCursorSwitcher cursorSwitcher(this, fListTree);
[…]
}
[/code]
Cheers, Bertrand.