Re: [ROOT] Using custom context sensitive menus.

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Sat Oct 12 2002 - 19:28:16 MEST


Hi Brett,

  you could do something like this:

set for the objects of this special class the kNoContextMenu bit. Check
in HandleInput() for event kButton3Down if the kNoContextMenu menu bit
is set for either the selected object, the pad or the canvas. If so,
don't popup the context menu. User's can trap this event via the
TCanvas::ProcessedEvent() signal and do a user defined action instead.
Like poping up a custom popup menu. An example is shown in
$ROOTSYS/tutorials/guitest.C.

Cheers, Fons.


On Wed, 2002-10-02 at 20:07, Brett Viren wrote:
> Hi,
> 
> I have:
> 
> 	class GuiMenu : public TGPopupMenu
> and
> 	class GuiMenuBar : public TGMenuBar
> 
> 
> Currently I create a GuiMenu for a particular class of graphical
> objects in a TPad.  This menu is used as a submenu in one of the
> GuiMenuBar's menus.
> 
> I would like to also use this submenu as a context sensitive popup
> menu.  Is there some way to tell the TContextMenu system to use this
> submenu ?
> 
> As far as I can tell the only way to do this is to subclass
> TRootGuiFactory, overriding CreateContextMenuImp and then swap out
> gGuiFactory.  Is there a better way?
> 
> 
> Thanks,
> -Brett.
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET