Beci has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I'd like to run another program from my script. Both programs have a Tk interface. My problem is that when child exits, the MainWindow of the main script loses focus. It is a problem for me because the main program uses a barcode reader in keyboard emulation mode. When the MainWindow loses its focus, the bindings of the keyboard to $mw don't work, of course. I don't want to tell the operators to left-click into $mw before using the barcode reader.Is there a way to give the focus back to $mw after the child process closes? Here is my code, it doesn't give back te focus:
Thanks,$mw->iconify; $mw->withdraw; unless(open(HND,"<vmapper.ini")) { &fileRdWrError('vmapper.ini','read','p1_appendMsgToLog'); exit 0; } my $line = <HND>; chomp $line; close HND; system($line.'vmapper.exe'); #other program exited, continue from here $mw->raise; $mw->deiconify; $mw->update; $mw->focus; #should give the focus back here
Beci
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Tk focus
by Anonymous Monk on Jan 08, 2012 at 20:14 UTC | |
by Beci (Initiate) on Jan 08, 2012 at 22:04 UTC | |
|
Re: Tk focus
by Khen1950fx (Canon) on Jan 08, 2012 at 17:44 UTC |