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

From: Diego Faso <faso_at_to.infn.it>
Date: Fri, 25 Feb 2005 17:45:00 +0100 (MET)


Thanks a lot: I tried a combination of the "disable/detect" close action: I disabled the mouse-action as you suggested, and it worked without any problem, hence, since I had some problem while trying to connect to TGMainFrame::CloseWindow() , I connected a new method to TRootCanvas::CloseWindow(), where the TRootCanvas is "i" in your example: in this way the mouse-action "close" is redirected to the method defined in my class.
Thank you again, cheers
Diego

On Fri, 25 Feb 2005, Valeriy Onuchin wrote:

> 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 - 17:45:07 MET

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