#!/usr/bin/perl use warnings; use strict; use Tk; my $mw = MainWindow->new(); my $f = $mw->Frame(-border => 1) ->pack(-side => "left", -fill => "both"); my $envs_list; $envs_list = $f->Scrolled("Listbox", -scrollbars=>"e", -exportselection => 0, -selectmode=>"extended")->pack(-fill => 'both'); $envs_list->insert("end", "abcda"); $envs_list->insert("end", "abcdb"); $envs_list->insert("end", "abcdc"); $envs_list->insert("end", "abcdd"); my $list; $list = $f->Scrolled("Listbox", -scrollbars=>"e", -exportselection => 0, -selectmode=>"extended")->pack(-fill => 'both'); $list->insert("end", "abcd1"); $list->insert("end", "abcd2"); $list->insert("end", "abcd3"); $list->insert("end", "abcd4"); $list->insert("end", "abcd5"); $mw->Button( -text => "Selections", -command => sub{ my $selected_env_list = $envs_list->get( $envs_list->curselection ); my $selected_list = $list->get( $list->curselection ); print "selected-> $selected_env_list $selected_list\n"; } )->pack( -side => 'left' ); $mw->Button( -text => "Exit", -command => \&exit )->pack; MainLoop;
In reply to Re: Perl/TK listbox question
by zentara
in thread Perl/TK listbox question
by tarlos25
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |