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
Any help would be greatly appreciated.$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(); }
Mark
update (broquaint): added <code> tags and fixed formatting
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |