Hello everyone,

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??


In reply to Problems with Tk on Win32 by sfinster

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.