tkispell
view release on metacpan or search on metacpan
lib/Tk/SimpleFileSelect.pm view on Meta::CPAN
-initialtext => [ 'PASSIVE', undef, undef, '' ],
DEFAULT => [ 'dir_list' ],
);
$w->protocol('WM_DELETE_WINDOW' => ['Cancel', $w ]);
$w->{'reread'} = 0;
my $l = $w -> Component( Label => 'entry_label',-text => 'File Name: ');
$l -> grid( -column => 1, -row => 3, -padx => 5, -pady => 5 );
my $e = $w -> Component(Entry => 'file_entry',
-textvariable=>\$w->{Configure}{-initialtext});
$e->grid(-column => 2, -columnspan => 1, -padx => 5, -pady => 5,
-row => 3, -sticky => 'e,w' );
$e->bind('<Return>' => [$w => 'Open', Ev(['getSelected'])]);
my $lb = $w->Component( ScrlListbox => 'dir_list',
-scrollbars => 'se', -width => \$w -> {Configure}{-width},
-height => \$w -> {Configure}{-height} );
$lb -> Subwidget('yscrollbar') -> configure(-width=>10);
$lb -> Subwidget('xscrollbar') -> configure(-width=>10);
$lb->grid( -column => 2, -row => 1, -rowspan => 2, -padx => 5,
-pady => 5, -sticky => 'nsew' );
$lb->bind('<Double-Button-1>' => [$w => 'Open', Ev(['getSelected'])]);
my $scriptname = $O;
sub mainwindow {
$cw = new MainWindow (-title => $O);
$b1 = $cw -> Balloon ();
@opts = (-padx => 5, -pady => 5);
my $cl = $cw->Scrolled ('Text', -height => 3, -wrap => 'none',
-font => $fn, -scrollbars => 'se');
$b1 -> attach ($cl, -balloonmsg => 'Misspelled text.');
$cl->Subwidget($_)->configure(-width=>10) foreach('xscrollbar','yscrollbar');
$cl->grid (-row => 2,-column => 1,-columnspan => 3,-sticky => 'ew',@opts);
$cw->Advertise ('text' => $cl);
my $lb = $cw -> Scrolled ('Listbox', -font => $fn, -scrollbars => 'osoe');
$lb->grid(-row => 3,-column => 1,-columnspan => 2,-sticky => 'ew',@opts);
$cw->Advertise('list' => $lb);
$b1 -> attach ($lb, -balloonmsg => 'Selection of replacement words.');
my $f = $cw->Frame(-container => 0)->grid(-row => 3,-column => 3);
my $b = $cw->Button (-text => 'Accept',-command => sub {checknext ()},
-width => 15, -font => $fn);
$b->grid(-row => 1, -column => 1, -in => $f, -sticky => 'w', @opts);
$b1 -> attach ($b, -balloonmsg => 'Accept the misspelled word.');
$b = $cw->Button(-text => 'Add', -command => sub {push
@addlist, (gettextselection ()); checknext ()},
-width => 15, -font => $fn);
$b1 -> attach ($b, -balloonmsg => 'Replace all occurrences of misspelling.');
my $l = $cw->Label (-text => 'Replace with:', -font => $fn, -width => 15);
$l->grid(-row => 5, -column => 1, -padx => 5, -in => $f, -sticky => 'w');
my $e = $cw->Entry (-width => 20);
$e->grid(-row => 6, -column => 1, -padx => 5, -in => $f, -sticky => 'ew');
$cw->Advertise ('replaceentry' => $e);
$b1 -> attach ($e, -balloonmsg => 'Edit and replace the misspelling.');
$lb -> bind ('<Button-1>', sub { $e->delete (0,'end');
$e->insert(0, $lb->get ($lb->curselection))});
$f2 = $cw->Frame(-container => 0);
$f2->grid (-row => 5, -column => 1, -columnspan => 4, -sticky => 'ew');
$b = $cw->Button(-text => 'Check...', -command => sub {checkfirst ()},
-width => 15, -font => $fn);
$b1 -> attach ($b, -balloonmsg => 'Begin spell check.');
$b -> grid (-row => 5, -column => 1, -sticky => 'ew', -in => $f2, @opts);
$b = $cw -> Button (-text => 'Select File...',
-command => sub {selectfile ()},-width => 15, -font => $fn);
$b1 -> attach ($b, -balloonmsg => 'Select file to spell check.');
$b -> grid (-row => 5, -column => 2, -sticky => 'ew', -in => $f2, @opts);
$b = $cw -> Button (-text => 'Dismiss', -command => sub{save_and_exit ()},
-width => 15, -font => $fn);
( run in 0.308 second using v1.01-cache-2.11-cpan-a5abf4f5562 )