Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Simple Question 1

Status
Not open for further replies.

nickthegreek82

Programmer
Jan 4, 2006
6
GR
Hello there!
I am new in TCL and Tk programming and i have a problem with my project i am on.
I have deactivated the resize icon in title bar of my application and i want to do the same with the "X" wich destroys the widget. Is it possible to do that ? If not i want to have a procedure executed when pressing the "X" in the title bar... can i do this ?
Any help will be highly appreciated.
Thanks in advance
Nick
 
look at the "[red]overridedirect[/red]" option of the wm (window management) command. From the help file:
wm overrideredirect window ?boolean?
If boolean is specified, it must have a proper boolean form and the override-redirect flag for window is set to that value. If boolean is not specified then 1 or 0 is returned to indicate whether or not the override-redirect flag is currently set for window. Setting the override-redirect flag for a window causes it to be ignored by the window manager; among other things, this means that the window will not be reparented from the root window into a decorative frame and the user will not be able to manipulate the window using the normal window manager mechanisms.

_________________
Bob Rashkin
 
Sorry. It's [red]overrideredirect[/red].

_________________
Bob Rashkin
 
Does anyone knows how to have a procedure exetuted when presing the "x" button it the title bar before the program exits ?
Thanks!
 
Hi

Theoretically, somehow like this :
Code:
bind . <Destroy> { puts "Bye !" }
Practically, the code is executed for each widget on that window. But there is a warning in the manual :
bind.htm said:
When the Destroy event is delivered to a widget, it is in a ``half-dead'' state: the widget still exists, but most operations on it will fail.

With the above [tt]bind[/tt] I can close an open socket before exiting, but cannot save settings in a file. So I hope someone knows a better way.

Feherke.
 
Thanks my friend for your time.
I found another solution ...

wm protocol . WM_DELETE_WINDOW { procedure_name }

There are some limitations though to that procedure , i think you can not set any values to variables.

Hope this works for you as well!

Nick
 
I think a better (in the sense of more controllable and predictable) way would be to pull off all the decorations (with overrideredirect) and put your own "x-button" on with what ever -command you want.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top