Double-Click action in custom class

Dear developers.
I looked around the forum and the manual but I didn’t happen to find an answer to this question:

If I write a custom class, what should I do, if the operation is possible, to execute a specific function when I double click on an instance of the class visible in the standard TBrowser?
For example when I double-click on an histogram in the browser it draws the histogram in the active pad.
Now I have my custom class where I redefine my draw method and I would like to double-click on the object in the browser and execute the draw of my custom class in the active pad, just like with the histogram.

PS I know that I can do it with the right click and selecting the Draw method from the drop down menu and that works fine but I was wondering if there was also a way to have the double click connected to a default action

Hi,

Try to add a “Browse(TBrowser *b)” method in your class, overloading the TObject::Browse(TBrowser *b) method, where you can call your Draw() method. e.g. void YourCustomClass::Browse(TBrowser *b) { Draw(); }[color=#0000FF]Browse(TBrowser *b)[/color] is the default action for double click

Cheers, Bertrand.

Thank you very much.
It works exactly as I wished. Maybe this feature should be documented in the user manual in the same chapter about Graphics where the MENU CINT extension is documented to allow other user to benefit from this functionality

Stefano