Hi All,

Background. I have a perl script that runs on a win32 machine, k.pl, and it have several .pms located in perl site/lib/k. One of these .pms is a menu .pm and it has a pull down menu option called "select all" for selecting all of the elements on the canvas. It's also worth pointing out the my GUI is Perl Tk.

What I'm trying to do is to have the "select all" command run without the user having to pull down and select it, in one part of k.pl. So far no luck.

Here's the code from menu.pm to select all of the elements on the canvas

$C{'Select All'} = [ command => 'Select All', -command => [ sub { select_all(@_); }, $c ] ]; Here's the select_all sub # # Select all proteins in a canvas. # # Input: $c canvas # Output: - # Global: %global trace_me(); my ($c) = @_; our (%global); Globals->debug(1, "select_all called.\n"); my (@list, $count, $pb, $pct_complete, $step, $tag, $tag_count); @list = grep(/^id/, map { $c->gettags($_) } $c->find('all')); $tag_count = $#list; $step = int($tag_count / 15); $pb = progress_bar({-title => 'Selecting all proteins', -variable => \$pct_complete, }); $pb->Busy(); # Loop through tags and select. foreach $tag (@list) { # Skip if already selected. next if (exists($global{$c}->{selected}->{$tag})); # Change outline to selected. $global{$c}->{selected}->{$tag} = $c->itemcget($tag, '-fill'); $c->itemconfigure($tag, -fill => 'black', -outline => 'blue', -width => 2); $global{$c}->{selected_count}++; $count++; if ($count % $step == 0) { $pct_complete = ($count / $tag_count) * 100; $pb->update(); } } select_update($c); $pb->Unbusy(); $pb->destroy(); }
Any help would be greatly appreciated.

Mark

update (broquaint): added <code> tags and fixed formatting


In reply to Doing what a menu command would do with out selecting it by Anonymous Monk

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.