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

Destroy messagebox

Status
Not open for further replies.

pri04

Technical User
Jan 4, 2011
7
0
0
IN
I created a message box with command:
tk_messageBox -type ok -icon warning -message "Error occured" -title "Configuration file error" -parent .

Is there a way to destroy this message box after a certain time interval without user intervention?
 
Thanks

Would it be possible to create a tk_dialog with just text message and no buttons on it?
 
From the help:
tk_dialog - Create modal dialog and wait for response

SYNOPSIS
tk_dialog window title text bitmap default string string ...


DESCRIPTION
This procedure is part of the Tk script library. Its arguments describe a dialog box:

window
Name of top-level window to use for dialog. Any existing window by this name is destroyed.
title
Text to appear in the window manager's title bar for the dialog.
text
Message to appear in the top portion of the dialog box.
bitmap
If non-empty, specifies a bitmap to display in the top portion of the dialog, to the left of the text. If this is an empty string then no bitmap is displayed in the dialog.
default
If this is an integer greater than or equal to zero, then it gives the index of the button that is to be the default button for the dialog (0 for the leftmost button, and so on). If less than zero or an empty string then there won't be any default button.
string
There will be one button for each of these arguments. Each string specifies text to display in a button, in order from left to right.

It seems to say that if you supply NO string arguments, there will be no buttons.

_________________
Bob Rashkin
 
Thanks. I'll try this out and see if it works.
 
Calling the tk_dialog without the button names doesn't work as it gives syntax error. But that's fine as it's not my major requirement to hide button.

I have another issue:
After I display the tk_dialog, I want it to be destroyed after some time but this time interval is not defined.
I want that as soon as some folders on my system get created the dialog box should not be visible.

I wrote the following code:

tk_dialog .dialog1 "Dear user:" "Click ok!" info "ok" "no"
file mkdir C:/TestFolder
destroy .dialog1

But the problem is that when the dialog is created through first line, the code doesn't move to the second line until the dialog is closed.
Is it possible that when the dialog is created, the code execution moves on to next line without waiting for dialog button click.

 
I think you want to use the "toplevel" widget rather than the "dialog". A dialog, by its nature, suspends further processing until the response happens (the "dia" in dialog). If you use the toplevel, you'll need to supply the buttons and actions yourself (as you would on the main window).

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top