Hello, Piet! You might try this subsequent code for your purpose. I've taken one of the files of the examples and changed it for the purpose ot this widget. Henrik Hedemann
################################################ # dirselect # ################################################ # usage $path=dirselect($title); # # selects a directory from WinNT system and # # returns it. # # sub dirselect { my $title=shift; my ($i,$ans,$drive,$hashkey); my (@drvs,@dirs); $Window = new GUI::Window( -name => "widgets::Window", -title => "Dirselect: $title", -height => 430, -width => 265, -left => 100, -top => 100, ); $TV = $Window->AddTreeView( -name => "widgets::Tree", -text => "hello world!", -width=> $Window->ScaleWidth, -height=> $Window->ScaleHeight-100, -left => 0, -top => 0, -lines => 1, -rootlines => 1, -buttons => 1, -visible => 1, ); $Wlabel=$Window->AddLabel(-text=>"Selected:", -left=>10, -top=>350); $Wtext=$Window->AddTextfield(-name=>"widgets::Selected", -left=>70, -top=>350, -height=>20, -width=>260); $Waccept=$Window->AddButton(-text =>"Accept", -left =>10, -top =>380, -height=>20, -name =>"widgets::Wacc"); $Wdismiss=$Window->AddButton(-text =>"Dismiss", -left =>260, -top =>380, -height=>20, -name =>"widgets::Wdis"); $hashkey="\\"; $tree{$hashkey} = $TV-> InsertItem(-text => "\\", -item => 0, ); $key[$tree{$hashkey}]=$hashkey; for($i=0;$i<=24;$i++){ $ans=chr(ord('C')+$i); $drive=$ans.":\\"; if (-d "$drive/"){ $tree{$drive}= $TV->InsertItem(-parent => $tree{"\\"}, -text => "$ans"); $key[$tree{$drive}]=$drive; push(@drvs, $drive); } } foreach $drive (@drvs) { opendir(DIR, $drive); undef @dirs; foreach $i (readdir(DIR)) { if ((-d "$drive/$i" )&& ($i ne "..") && ($i ne ".")) { push (@dirs, $i); } } closedir(DIR); foreach($i=0;$i<=$#dirs;$i++) { $hashkey=$drive.$dirs[$i]."\\"; $tree{$hashkey}=$TV-> InsertItem(-parent => $tree{$drive}, -text => "$dirs[$i]"); $key[$tree{$hashkey}]=$hashkey; } } $Window->Show(); Win32::GUI::Dialog(); $path=$Wtext->Text(); return $path; } sub Wacc_Click { undef(@tree); undef(@key); $Window->Hide(); return -1; } sub Wdis_Click { undef(@tree); undef(@key); $Window->Hide(); $path=""; return -1; } sub Window_Terminate { undef(@key); undef(@tree); $Window->Hide(); $Wtext->Text(""); $Window->PostQuitMessage(0); } sub Window_Resize { my $w=$Window->ScaleWidth; my $h=$Window->ScaleHeight; $TV->Resize($w,$h-100); $Wlabel->Move(10,$h-70); $Wtext->Move(70,$h-70); $Wtext->Resize($w-90,20); $Waccept->Move(10,$h-40); $Wdismiss->Move($w-90,$h-40); } sub Tree_NodeClick { my %node = $TV->GetItem($_[0]); $path=$key[$_[0]]; if ($path ne "\\") { $Wtext->Text($path); }else { $Wtext->Text(""); } return 1; } sub Tree_Expand { my %node = $TV->GetItem($_[0]); my ($hk,$sd); my @sds; $path=$key[$_[0]]; if ($path ne "\\") { opendir(DIR, $path); foreach $i (readdir(DIR)) { if ((-d $path.$i )&& ($i ne "..") && ($i ne ".")) { $sd=$path.$i."\\"; opendir(SDIR, $sd); undef @sds; foreach $j (readdir(SDIR)) { if ((-d $sd.$j )&& ($j ne "..") && ($j ne ".")) { push (@sds, $j); } } closedir(SDIR); for($j=0;$j<=$#sds;$j++) { $hk=$sd.$sds[$j]."\\"; if (!($key[$tree{$hk}])) { $tree{$hk}=$TV-> InsertItem(-parent =>$tree{$sd}, -text =>"$sds[$j]"); $key[$tree{$hk}]=$hk; } } } } closedir(DIR); } return 1; } sub Tree_Collapse { my %node = $TV->GetItem($_[0]); $path=$key[$_[0]]; return 1; } ################################################ # end: dirselect # ################################################ > -----Original Message----- > From: Piet De Jong [SMTP:[EMAIL PROTECTED] > Sent: Thursday, May 03, 2001 10:52 PM > To: 'perl-win32-gui-users@lists.sourceforge.net' > Subject: [perl-win32-gui-users] Using GetOpenFileName > > > Hi > I want to be able to show a dialog box with just a directory listing. > > Can I pass any parameters to the function GetOpenFileName to only show > information relative to directories > return the selected directory ? > > Or is there a different function that I need to use ? > > Many thanks, > Piet >