views:

797

answers:

1

Hi,

Is there a way to make a Perl/Tk window's close ('X') button disabled? I know how to ignore clicking it using the technique described here, but I would much rather have it disabled.

I'm using Perl/Tk on Windows.

Thanks,
splintor

+2  A: 

If you are in a Unix environment you are out of luck. The "close" button is managed by the Window Manager of the desktop which is a completely different process that you have no control on.

Even if by a hack you disable the "close" button the user can always bring it back if the window manager permits this. The enlightenment window manager for example can enable/disable all window buttons on demand.

The technique you give in the link is doing exactly this. It does not remove the "close" button. It just gives a hint to the window manager (WM_DELETE_WINDOW). It is up to the window manager if this hint will be honoured or not.

See also the icccm and NetWM pages.

What you want might be possible on Windows, but my experience with this OS is limited so perhaps another poster will know this.

kazanaki
Thanks, but I'm on Windows.
splintor
I think that since perl/TK are cross-platform (lowest common denominator) even in Windows you would need a serious hack to do what you want.
kazanaki