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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to not draw the window frame

Status
Not open for further replies.

neerg

Technical User
Jun 1, 2003
4
US
Hi,

Is there a way to not draw the window of a frame once I have position the window within the computer screen. I mean the Minimize, Restore down and Close button.

Thanks
 
You might find that wm overrideredirect does what you need. It tells the window manager not to manage the window, and so the window manager doesn't add the titlebar, resize handles, etc. For example:

Code:
wm overrideredirect . 1

On a few poorly written window managers, you might need to withdraw and re-display the window before it takes effect:

Code:
wm withdraw .
wm deiconify .
- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Thanks. It work.

Can I know if it is possible to move the frame after I have remove the window?
 
Ah, that's the downside of using wm overrideredirect. As the window manager doesn't provide any decorations, there's no way by default for the user to move or resize the window.

Your application can programmatically change the size and position of the window using the wm geometry command. But to give the user the chance to move or resize the window, you'd have to create your own set of widget controls, along with bindings that issued the proper wm geometry commands.

If this is all sounding like a lot of work, that's because it is. wm overrideredirect is meant to circumvent the window manager for special, transient windows. Trying to then re-implement much of the window manager's functionality in Tcl is usually a bad idea. If you're seriously thinking of starting down this path, I'd suggest that an override-redirect window really isn't appropriate for your situation.

If your goal is to reduce the amount of window manager decorations on a window, you might try wm transient instead of wm overrideredirect. wm transient marks a window as a "transient" window working on behalf of another "master" toplevel. Most window managers usually give such windows a limited set of decorations. On Windows, they get the title and a close icon. If you wanted, you could then even disable the close icon (though it would still appear) by installing a WM_DELETE_WINDOW protocol handler that did nothing when the user tried to close the window. Here's how you'd put it together:

Code:
toplevel .dialog
wm transient .dialog .
wm protocol .dialog WM_DELETE_WINDOW {
  # Ignore close icon
}

label .dialog.l -text {Click "Ok" to close}
button .dialog.ok -text "Ok" -command {
  destroy .dialog
}

pack .dialog.l .dialog.ok -padx 4 -pady 4
- Ken Jones, President, ken@avia-training.com
Avia Training and Consulting, 866-TCL-HELP (866-825-4357) US Toll free
415-643-8692 Voice
415-643-8697 Fax
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top