Hi all,
I have a Perl/Tk question for which I haven't been able to
find an answer in the excellent "Mastering Perl/Tk" book.
I am creating a database interface for use on Windows, and
so far Tk has been perfect for it. Here's my problem. I've
created two items on a drop-down menu to control the sort
method applied to the results of a db query. If the user
selects option 1, she'll get a list of products sorted by item
number. If she selects option 2, she'll get the same list,
sorted by sales dollars. So I set it up by passing different
parameters to the subroutine which does the query. Like so:
$action->command(-label=>"Sort by Number",-command=>\&queryDB("item_nu
+mber"));
$action->command(-label=>"Sort by Sales",-command=>\&queryDB("tot_sale
+s"));
The query works perfectly, but the weird thing is that when
I'm passing parameters like this, it runs automatically each
time I start the application, whether or not I've selected
either one of the menu choices! The product list comes back
twice, sorted once by dollar sales, and once by product
number.
If anyone can see what I'm doing wrong, or if you know of a
Tk-specific method of passing parameters to a subroutine,
I would be most deeply indebted to you.
Thanks very much,
a Tk novice
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.