Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Tk- getOpenFile sticks on W2K server (http://www.velocityreviews.com/forums/t900041-tk-getopenfile-sticks-on-w2k-server.html)

MoshiachNow 09-25-2006 10:18 AM

Tk- getOpenFile sticks on W2K server
 
HI,

It works nicely on my XP,but sticks on W2K.

Any suggestion for a better fileselct for Tk,or how to use getOpenFile
on W2k ?

Thanks


zentara 09-25-2006 12:06 PM

Re: Tk- getOpenFile sticks on W2K server
 
On 25 Sep 2006 03:18:44 -0700, "MoshiachNow" <lev.weissman@creo.com>
wrote:

>HI,
>
>It works nicely on my XP,but sticks on W2K.
>
>Any suggestion for a better fileselct for Tk,or how to use getOpenFile
>on W2k ?
>
>Thanks



Did you look at the requirements for ActiveStatePerl ( assuming that
is what you are using)? W2k needs to be at Service Pack 5+.

You can always write your own, like:

#!/usr/bin/perl
use strict;
use Tk;
require Tk::DirTree;
require Tk::Adjuster;
require Tk::TList;

# The initial directory
my $initial_dir = '/';

# The main window...
my $main = new MainWindow( -title => 'Explorer)' );

# A frame for the tree, adjuster and tlist
my $tree_adj_tablist = $main->Frame();
$tree_adj_tablist->pack(
-expand => 'yes',
-fill => 'both',
-side => 'top'
);

# A scrolled directory tree
my $tree = $tree_adj_tablist->Scrolled(
'DirTree',
-width => 35,
-height => 25,
-scrollbars => 'osoe',
-background => 'White',
-selectmode => 'single',
-selectbackground => 'DarkBlue',
-selectforeground => 'White',
-showhidden => 1,
-directory => $initial_dir
);
$tree->pack(
-expand => 'yes',
-fill => 'both',
-padx => 2,
-pady => 2,
-side => 'left'
);

# An adjuster
my $adjuster = $tree_adj_tablist->Adjuster(
-widget => $tree,
-side => 'left'
);
$adjuster->pack( -side => 'left', -fill => 'y' );

# A scrolled tab_list widget
my $tab_list = $tree_adj_tablist->Scrolled(
'TList',
-background => 'White',
-orient => 'vertical',
-selectmode => 'extended',
-scrollbars => 'os'
);
$tab_list->pack(
-expand => 'yes',
-fill => 'both',
-padx => 2,
-pady => 2,
-side => 'right'
);


# Ok button
my $ok = $main->Button(
-text => 'Ok',
-underline => 0,
-width => 4,
-command => sub { my $selected = $tab_list->info('selection');
#print "@{$selected}\n";
foreach( @{$selected} ){
print $tab_list->entrycget($_, '-text'),"\n";
}
})->pack( -side => 'right', -padx => 10, -pady => 10 );


# A Quit button (will be suppressed???...)
my $quit = $main->Button(
-text => 'Quit',
-underline => 0,
-width => 6,
-command => sub { exit }
);
$quit->pack( -side => 'right', -padx => 10, -pady => 10 );

# Configuring tree and tab_list widgets...
$tree->configure( -browsecmd => sub { list_dir( $tab_list, @_ ); } );

# We list the content of the initial dir inside the tab_list
list_dir( $tab_list, $initial_dir );

MainLoop();

#----------------------------------------------------------------------------

# Displays Dirs and files in TList widget
sub list_dir {
my ( $tab_list, $path ) = @_;

# Erase the TList content
$tab_list->delete( 0, 'end' );

opendir MY_DIR, $path or return;

foreach my $file ( sort readdir(MY_DIR) ) {

# Do not display '.' and '..'
next if ( $file eq '.' or $file eq '..' );

# Insert the files in the TList
$tab_list->insert( 'end', -text => $file );
}
closedir MY_DIR;
}

__END__


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

MoshiachNow 09-25-2006 01:26 PM

Re: Tk- getOpenFile sticks on W2K server
 
Great !!!
Thanks


MoshiachNow 09-26-2006 05:42 AM

Re: Tk- getOpenFile sticks on W2K server
 
# The initial directory
my $initial_dir = '/';


How do I cause the browser to see all disks from the top,not only my
current disk ?
Thanks


zentara 09-26-2006 10:20 AM

Re: Tk- getOpenFile sticks on W2K server
 
On 25 Sep 2006 22:42:00 -0700, "MoshiachNow" <lev.weissman@creo.com>
wrote:

># The initial directory
>my $initial_dir = '/';
>
>
>How do I cause the browser to see all disks from the top,not only my
>current disk ?
>Thanks


Well I use linux, and '/' is the top. All other disks have to be mounted
somewhere on /.

If you are using Windows, I don't know how they do it.


--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html

David Harmon 10-02-2006 06:33 AM

Re: Tk- getOpenFile sticks on W2K server
 
On Tue, 26 Sep 2006 10:20:05 GMT in comp.lang.perl.misc, zentara
<zentara@highstream.net> wrote,
>Well I use linux, and '/' is the top. All other disks have to be mounted
>somewhere on /.
>
>If you are using Windows, I don't know how they do it.


use Win32API::File ("getLogicalDrives");
@roots= getLogicalDrives()


MoshiachNow 11-16-2006 08:45 AM

Re: Tk- getOpenFile sticks on W2K server
 

>
> use Win32API::File ("getLogicalDrives");
> @roots= getLogicalDrives()


Thanks,

but I need a GUI window for user to browse it ...



All times are GMT. The time now is 08:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57