Re: Canvas: mouse action (close) disable/detect

From: Valeriy Onuchin <Valeri.Onoutchine_at_cern.ch>
Date: Fri, 25 Feb 2005 16:55:27 +0100


Hi Diego,
1. to disable "Close" button

root [0] c = new TCanvas()
root [1] i = (TRootCanvas*)c->GetCanvasImp()
root [2] i->DontCallClose()

but it will still possible minimize/iconify canvas. Under x11 minimzimg/iconifying windows is a "job" of windows manager

You can try the following (no 100% guarantee that will work and depends on windows manager)

/* MWM decorations values */

#define MWM_DECOR_NONE          0
#define MWM_DECOR_ALL           (1L << 0)
#define MWM_DECOR_BORDER        (1L << 1)
#define MWM_DECOR_RESIZEH       (1L << 2)
#define MWM_DECOR_TITLE         (1L << 3)
#define MWM_DECOR_MENU          (1L << 4)
#define MWM_DECOR_MINIMIZE      (1L << 5)
#define MWM_DECOR_MAXIMIZE      (1L << 6)


i->UnmapWindow()
gVirtualX->SetMWMHints(i->GetId(), MWM_DECOR_BORDER, 0, 0) i->MapWindow();

2. to detect "minimize/iconify" action
connect to TGFrame::ProcessedEvent signal and check for event->fType == kStructureNotify event

3. to detect "close/delete window" action connect to TGMainFrame::CloseWindow() signal

HTH. Regards. Valeriy

Diego Faso wrote:

> Hello, I need to disable the possibility of closing/minimizing a canvas
> (TCanvas) by using the "minimize/close" standard buttons, or at least to
> detect the "minimize/close mouse-action".
> Is there a way to do it?
> I thought to connect the "close-mouse-action" to a method of my class, but
> I don't know which method of TCanvas is called when I close the canvas.
>
> Tahnk you, cheers
> Diego
Received on Fri Feb 25 2005 - 16:55:32 MET

This archive was generated by hypermail 2.2.0 : Tue Jan 02 2007 - 14:45:05 MET