sfinster has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a Tk script that needs to work on both Windows (Most likely NT) and linux/solaris. Unfortunately some of our tools are out of date.
I have the added requirement of reading a couple of variables out of the registry on the Win32 systems instead of getting them from the command line.
Prior to last week, I was using Perl version 5.6.1. It does not appear to have registry support, so I downloaded ActivePerl-5.8.4.810-MSWin32-x86.msi and installed it.
I've noticed some problems since then. Most troublesome is the fact that my validation callbacks for my entry fields only appear to work once. The first time I enter invalid data, everything works as expected. From then on, the "type" argument is 8 instead of the expected 1, 0, or -1. Has anyone seen this?
Second question: Is there a way to have a "use Win32::Registry" line that will only be loaded on Win32? It's unnecessary on my solaris box, and causing problems.
Thanks.
Update:
I was finally able to get around my Registry issues by using the "Trapping errors in require or use" solution in the Perl Cookbook. I found that the only way I could get things to work on both Win32 and our version of Solaris (2.6) was to require the module in the begin/eval structure, and to import it later on. I had to fully qualify the $Registry variable and all the calls, but it finally worked.
On the Tk::Entry issue, I've found that how I define the callback determines the values that get sent into it.
If I define the validation style as 'focus', my $type variable gets a 3 on enter focus and a 4 on leave focus.
If I define a 'key' validation, $type gets 6 on a forced validation, 7 on text deletion, and 8 on text entry.
I modified the widget program to determine this, so I know it's not just my program. The Tk::Entry perldoc still says that the values should be -1, 0, and 1. Anyone??
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problems with Tk on Win32
by tall_man (Parson) on Oct 04, 2004 at 16:51 UTC | |
by Madams (Pilgrim) on Oct 04, 2004 at 23:03 UTC | |
|
Re: Problems with Tk on Win32
by runrig (Abbot) on Oct 04, 2004 at 18:46 UTC | |
by pg (Canon) on Oct 04, 2004 at 20:49 UTC |