Sorry, here's a more detailed question.... I need to add multiple BrowseEntry to a table and get the selection, and the corresponding value of $layer. The table is built in a loop. I thought I could create a hash key to store when a selection is made in the drop down, but I don't know how to relate it to the $layer. (Why do I get the small window with the script name?) Here's an example

#!/usr/bin/perl use strict; use warnings; use Tk; use Tk::DialogBox; use Tk::LabFrame; use Tk::Table; use Tk::BrowseEntry; my $TKmain = MainWindow->new(); my $fontname = '-adobe-times-medium-r-normal--20-140-75-75-p-77-hp-rom +an8'; my $fontnameb = '-adobe-times-bold-r-normal--20-140-75-75-p-77-hp-roma +n8'; my @dropdownarray = ( 'Curly', 'Larry', 'Moe' ); my @layers = ( 'lyr1', 'lyr2', 'lyr3', 'lyr4', 'lyr5' ); my @scx = ( '1', '2', '3', '4', '5' ); $TKmain->DialogBox(-title=>"Set Scales",-buttons=>["OK", "Cancel"]); my $dlgSetScales = $TKmain->DialogBox(-title=>"Set Scales",-buttons=>[ +"OK", "Cancel"]); $dlgSetScales->resizable(0,0); $dlgSetScales->{SubWidget}{B_Cancel}->configure(-font=>$fontnameb,-bg= +>"firebrick"); $dlgSetScales->{SubWidget}{B_OK}->configure(-font=>$fontnameb,-bg=>"fo +restgreen"); my $f = $dlgSetScales->Frame()->pack(-fill=>'both'); $f->Label(-text=>"Set Scales",-font=>'-adobe-times-bold-r-normal--32-1 +00-75-75-p-57-iso8859-1')->pack(); my $table = $f->Table(-rows=>10, -columns=> 6, -scrollbars=>'e', -fixedrows=>1, -highlightbackground=>'black', -relief => 'raised', -fixedcolumns=>0, -takefocus=>1)->pack(-fill=>'x'); $table->put(0,0,$table->Label(-text=>" *Layer Name* ",-font=>$fontname +b,-bg=>"cadetblue")); $table->put(0,1,$table->Label(-text=>" *Scale X* ",-font=>$fontnameb,- +bg=>"mediumaquamarine")); $table->put(0,2,$table->Label(-text=>" *Scale Y* ",-font=>$fontnameb,- +bg=>"cadetblue")); $table->put(0,3,$table->Label(-text=>" *Factor X* ",-font=>$fontnameb, +-bg=>"mediumaquamarine")); $table->put(0,4,$table->Label(-text=>" *Factor Y* ",-font=>$fontnameb, +-bg=>"cadetblue")); $table->put(0,5,$table->Label(-text=>" *Map to Layer* ",-font=>$fontna +meb,-bg=>"mediumaquamarine")); my ($w,$cnt,%ScaleVal,$NewXScale,$NewYScale); my $xscale = 1.0002; my $yscale = 1.00018; $cnt = 1; foreach my $layer (@layers) { $ScaleVal{$layer} = {}; my $text = $layer; my $color = 'black'; $w = $table->Checkbutton(-text=>$text,-fg=>$color,-anchor=>'w',-va +riable=>\$ScaleVal{$layer}{CHECK},-font=>$fontname,-activebackground +=> "lightgoldenrodyellow"); $table->put($cnt,0,$w); $ScaleVal{$layer}{REALFACTORX} = $xscale; $ScaleVal{$layer}{REALFACTORY} = $yscale; $ScaleVal{$layer}{FACTORX} = sprintf("%0.06f",$xscale); $ScaleVal{$layer}{FACTORY} = sprintf("%0.06f",$yscale); $ScaleVal{$layer}{SCALEX} = sprintf("%0.01f",(($xscale-1)*12*1000) +); $ScaleVal{$layer}{SCALEY} = sprintf("%0.01f",(($yscale-1)*18*1000) +); #create labels w/ current scale $w = $table->Label(-textvariable=>\$ScaleVal{$layer}{SCALEX},-font +=>$fontname,-relief => 'groove'); $table->put($cnt,1,$w); $w = $table->Label(-textvariable=>\$ScaleVal{$layer}{SCALEY},-font +=>$fontname,-relief => 'groove'); $table->put($cnt,2,$w); $w = $table->Label(-textvariable=>\$ScaleVal{$layer}{FACTORX},-fon +t=>$fontname,-relief => 'groove'); $table->put($cnt,3,$w); $w = $table->Label(-textvariable=>\$ScaleVal{$layer}{FACTORY},-fon +t=>$fontname,-relief => 'groove'); $table->put($cnt,4,$w); $w = $table->BrowseEntry(-relief => 'groove'); foreach my $dropdownlist (@dropdownarray) { $w->insert('end', $dropdownlist); } $table->put($cnt,5,$w); #next row $cnt++; } $dlgSetScales->Show(); MainLoop();

In reply to Re^2: Multiple TK::BrowseEntry by mortbarsky
in thread Multiple TK::BrowseEntry by mortbarsky

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.