RE: object menu popup

From: Fine, Valeri <fine_at_bnl.gov>
Date: Mon, 26 Oct 2009 12:19:05 -0400


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


Brookhaven National Laboratory
Upton, NY 11973, USA
Phone: +1 631 344 7806
Fax: +1 631 344 4206
E-mail: fine_at_bnl.gov

> -----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