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!

Disabling Perl window with TK 4

Status
Not open for further replies.

dara

Technical User
Apr 24, 2001
6
GB
hi,
anyone know how to disable a perl window with tk?
thanks for your help!
 
I have not found a way to 'disable' a window. However, I have just started trying to figure out how to use the 'iconify' or 'withdraw' method to achieve the same effect.

......
# hide the window
$mw1->iconify;

# Do stuff in the second window
# on submit of second window,
$mw2->destroy;
$mw1->deiconifiy;
.......

iconify does not prevent the user from maximizing and playing in the first window. It simply minimizes the window.

The 'withdraw' method hides the window. There is no icon to maximize, thus the user is prevented from playing in the first window, until the requirements in the second window are satisfied.
......
# hide the window
$mw1->withdraw;

# Do stuff in the second window
# on submit of second window,
$mw2->destroy;
$mw1->deiconifiy;
.......

The one problem I have not figured out how to catch yet, is.....
When the first window is withdrawn, if the user closes the second window via the
window controls, rather than letting the application close it on a 'Cancel' or 'Continue' button, the first window stays withdrawn. The application is still running, but there are no displayed windows. There needs to be some way to watch the second window for an inappropriate close, so you can 'deiconify' the first window. If I figure out an effective way to manage 'withdraw', I'll post it.

HTH


keep the rudder amid ship and beware the odd typo
 
thanks for your help i'm trying it out at the moment
 
hey goBoating id like to do the same with the cmd window
(has to work on nt dont care about the rest)
my tkchat app use a few "print" before lauching the tk window
so this launch the tk window in the back of the cmd window ...

a) is it posible to specify "appear on top"
or b) how could i minimize the cmd window ?

thanks ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Here are a few options:

1) Don't even have a command window. This can be done by using wPerl instead of perl. If you have ActiveState Perl, you already have wPerl. To use wPerl, you can rename the application from *.pl to *.wpl or call your application like 'wperl myscript.pl'.

2) If using a shortcut, change the shortcut to run 'minimized'. Actually on my system (NT), when the Tk window is displayed, the command window is minimized automagically.

3) Make the Tk window appear on top. I can't remember how to do this, but I could look it up tomorrow.
 
1) but i was using the command window ...
2) no shortcuts. Has to be lauch by command window passing $ARGV
3) this what i need ....

but dont break your head on this ill use 1)
ill just change my app a bit ...

thanks ---------------------------------------
wmail.jpg


someone knowledge ends where
someone else knowledge starts
 
Hello,

There is a way to disable the perl window (see below), I think I found it in the perl cookbook by O'Reilly about a yr ago.
In the following script VPConsole.pl was a Tk application I wrote that just needs to be swapped out for your perl application:

#!/usr/bin/perl -w

# loader - starts Perl scripts without the DOS window

use strict;
use Win32; # i.e. a windows32 application
use Win32::process; # Create the process object.

Win32::process::Create($Win32::process::Create::processObj,
'C:/Perl/bin/perl.exe', #the location of perl
'perl VpConsole.pl', # The perl program to be run
0, # Don't inherit.
DETACHED_PROCESS, # Make it a detached process
"." # run from current dir.
) or die print_error();

sub print_error()
{
# print the standard windows error message.
return Win32::FormatMessage( Win32::GetLastError() );

}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top