|
Posted by Ch Lamprecht on January 30, 2007, 3:37 pm
Please log in for more thread options
Andy wrote:
> Does anyone know what the file pattern format is for the -filter
> argument of the perl tk::fbox module? The CPAN documentation for the
> module says filter is to be documented at a later date.
>
> The following code doesn't crash, however, the fileselector that is
> displayed isn't showing any .xls files even though I know they are in
> the directory. And, the "Files of Type" droplist in the fileselector
> is greyed out and disabled even though the filter specifies two
> choices. If I remove the -filter argument, the fileselector shows all
> files in the directory:
>
> use Tk;
> use Tk::FBox;
>
> my $mw = MainWindow->new;
> $spreadsheetfilename = $mw->FBox(
> -type => "open",
> -filter =>[
> ['Excel Files',['*.xls']],
> ['All Files','*.*']
> ]
> )->Show;
>
> I'm running Perl on windows XP.
>
> Andy
>
Maybe you want to use the -filetypes option??
-filter takes a glob expression. - or a coderef?
It is used internally, so you can't mix these.
my $spreadsheetfilename = $mw->FBox(
-type => "open",
#-filetypes =>[
#['Excel Files',['*.xls']],
#['All Files','*.*']
#],
-filter => '*.x++'
)->Show;
But why don't you use $mw->getOpenFile()?
Christoph
--
use Tk;package Tk::_;@ISA=('Tk::Frame');Tk::Widget->Construct
qw|_|,@?=qw'Just another Perl Hacker';sub Populate{($j)=@_;
$j->SUPER::Populate;$j->configure(-label=>shift@?)}
main::tkinit->_->$_->_->$_->_->$_->_->$_->update for 'pack';sleep 5;
|