Handling of mouse state

Dear Root-ers,

I have attached a signal to a TGListTree for a click message. This works well and I can see what button is clicked. In another section of the code I am successful in attaching a processed event for handling the full state of my mouse (when over a TCanvas). So at this point I’ve met some success handling the mouse.

Now here is my issue. I want to be able to handle my mouse event with the TGListTree when an object is being dragged (i.e. I click a tree item, hold down the mouse button, and then release the button somewhere). During this process I would like the slotted function to lock threads and manipulate some other portions of the code.

The issue I am having is getting the right signal (or any other technique) for handling the mouse event after I click on the TGListTree.

Currently, my TGListTree lives in a TGCanvas as well. Does anyone have a suggestion on a signal or other technique to use in order to control my program during the “dragging” process?

Some pseudocode below is what I would like:

TGCanvas *canvas = new TGCanvas(...);
TGListTree *LT = new TGListTree(canvas, kVerticalFrame);

void SomeFunction(Int_t event){

//Here I do handling of that pesky mouse, assuming event is the mouse event

if(event==1){//the first mouse button is pressed down}
if(event==11){//the first mouse button has been released}


So does anyone have an idea if this is possible without having to inherit and overwrite base functionality? Another idea I had was to wait for a button release after the “Clicked()” signal is emitted from TGListTree (though I feel like this would be a gross workaround).

John Perry

Hi John,

What about using the ProcessedEvent(Event_t*) signal from the TGListTree?

Cheers, Bertrand.

Dear Bertrand,

Thank you for the reply first off.

I will look into the ProcessedEvent signal, I’ve used it with other classes so maybe that will be the key to this issue. I’ll post another update when I get the chance to code it up.