It is simple
Here you are the relevant piece from some STAR GUI code
Assuming you now (x,y) pixel on screen position (Usually this is just a current cursor position) where you want the menu to be popped up:
#include "TContextMenu.h"
....
TContextMenu *fContextMenu=0;
....
if (!fContextMenu) fContextMenu = new
TContextMenu("BrowserContextMenu");
TObject *obj = (TObject *)GetMyPointer();
if (obj) {
fContextMenu->Popup(QCursor::pos().x(),QCursor::pos().y(),
obj,(TBrowser *)0);
}
....
You can do that by connecting the relevant signal your custom slot.
Hope this helps,
Best Regards
Valeri Fine
> -----Original Message-----
> From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch]
On
> Behalf Of Barna Daniel
> Sent: Saturday, October 24, 2009 6:18 PM
> To: roottalk_at_root.cern.ch
> Subject: [ROOT] object menu popup
>
> Hi,
>
> If a TH1 histogram is drawn in a canvas, right-clicking on it pops up
the
> transient object menu list (or whatever it is called).
>
> If I have a TGListBox, listing my histograms by name, can I somehow
pop-up
> the same menu list by right-clicking on a given histoname?
>
> Thanks
Received on Mon Oct 26 2009 - 17:19:12 CET
This archive was generated by hypermail 2.2.0 : Mon Oct 26 2009 - 17:50:02 CET