Yes you can do it. You can either set the refresh manually in some callback, or use the textvariable option. Just set $vss_path to whatever you want, and the Entry will automatically update. Otherwise, show a full working snippet and say what you want. Here is a clue on how to do it, you need to bind to the double click( or right-click) in the Listbox.
#!/usr/bin/perl use warnings; use strict; use Tk; my @cm_tools = ( "CVS", "VSS", "PVCS", "RCS", "Start Team" ); my $mw = MainWindow->new(); $mw->title("ZenSOFT Configuration Tool"); $mw->Label(-text => "Top", -background => "red")->pack(); $mw->Label(-text=>"CM Tool")-> pack(-expand => '1'); my @fruits0 = ('Apple','Banana','Cherry','Date','Elderberry','Fig'); my @fruits1 = ('Apple','Banana'); my @fruits = @fruits1; my $cm_tool = 'CVS'; my $vss_path = ''; $mw->Optionmenu( -options=> \@cm_tools, -textvariable=>\$cm_tool, -width=>'25', -command => sub{ #print "$cm_tool\n"; if( $cm_tool eq 'VSS'){ @fruits = @fruits0 } else{ @fruits = @fruits1 } }, )->pack(-expand => '1'); my $fruit_list = $mw->Listbox( -listvariable => \@fruits, )->pack();; $fruit_list -> bind("<Double-Button-1>",\&display); my $EndFrame= $mw ->Frame(-width => '40')->pack(-side => "bottom"); my $OkButton = $EndFrame->Button(-text => "Next", -width=>'10', -command => sub{$mw->destroy()})->pack(-padx=>'10',-pady=>'5', -s +ide=>'left'); my $CancelButton = $EndFrame->Button(-text => "Cancel", -width=>'10', -command => sub {exit })->pack(-padx=>'10',-pady=>'5', -side=>'ri +ght'); my $LoginBox = $EndFrame->Entry(-textvariable=>\$vss_path, -width=>'25')->pack(-expand => '1'); MainLoop(); sub display { $vss_path = $fruit_list -> get($fruit_list -> curselection); # $fruit_list->selectionClear(0, 'end'); }

I'm not really a human, but I play one on earth Remember How Lucky You Are

In reply to Re^5: Refresh windows in Perl TK by zentara
in thread Refresh windows in Perl TK 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.