~ubuntu-branches/ubuntu/vivid/horae/vivid

« back to all changes in this revision

Viewing changes to 0CPAN/Tk-GBARR-2.06/alpha/list

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2006-12-26 11:54:29 UTC
  • Revision ID: james.westby@ubuntu.com-20061226115429-kjuhf6h9w6bohlwj
Tags: upstream-063
ImportĀ upstreamĀ versionĀ 063

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
use lib 'alpha';
 
2
use Tk;
 
3
use Tk::ListMgr;
 
4
use Tk::Menubar;
 
5
 
 
6
my $mw = new MainWindow;
 
7
 
 
8
$mb = $mw->Menubar(-borderwidth => 2, -relief => 'raised');
 
9
$mb->Menubutton(-text => '~Help',-side => 'right');
 
10
$mb->pack(-side => 'top', -fill => 'x');
 
11
 
 
12
$lm = $mw->Scrolled('ListMgr',
 
13
    -scrollbars => 'e',
 
14
    -borderwidth => 2,
 
15
    -relief => 'flat', 
 
16
    -background => 'WhiteSmoke',
 
17
    -layout => 'vertical',
 
18
)->pack(-fill => 'both', -expand => 1);
 
19
 
 
20
$lm->focus;
 
21
$lm->subitemConfigure(0, -type => Image);
 
22
$lm->subitemConfigure(1, -type => Text);
 
23
$lm->subitemConfigure(2, -type => Text);
 
24
 
 
25
$f1 = $mw->Frame(-height => 20)->pack(-side => 'bottom', -fill => 'x');
 
26
$f1->Label(-text => 'Click middle button ...')->pack(-side => 'left');
 
27
 
 
28
use Tk::Pixmap;
 
29
 
 
30
$pm = $mw->Pixmap(-file => 'alpha/dir.xpm');
 
31
 
 
32
$lm->insert(0,
 
33
    [$pm,"a longer text","a longer text"],
 
34
    [$pm,"two","tdsdsawo"],
 
35
    [$pm,"three","a longer text"],
 
36
    [$pm,"four","a longer text"],
 
37
    [$pm,"five","a longer text"],
 
38
    [$pm,"a longer text"],
 
39
);
 
40
 
 
41
$lm->bind("<2>", [
 
42
    sub { 
 
43
        my $lmgr = shift;
 
44
        my $l = $lmgr->cget('-layout');
 
45
        $lmgr->configure(-layout => $l eq 'vertical' ? 'horizontal' : 'vertical');
 
46
    }
 
47
]);
 
48
 
 
49
 
 
50
Tk::MainLoop;
 
51