From: Peter E. <Pet...@at...> - 2001-04-12 12:45:53
|
I'd simply write the path\file to a data file somewhere and read it before you contruct your menu. You would write to this file every time someone opens or creates a file. You would probably also want to create a subroutine that limits how many files are kept, as such: ### untested! ### At the beginning of the script this sub would get called like &recentFilenames(); ### during your open file sub do something like this. $file = the file you just opened &recentFilenames(open,$file); ### sub recentFilenames { my ($what,$file) = @_; if ($what eq "open") { open(FILE,">>$recentFiles"); print FILE "$file\n"; close(FILE); push(@recentFiles,$file); shift(@recentFiles); } else { open(FILE,"$recentFiles"); @recentFiles=<FILE>; close(FILE); $count=@recentFiles; while ($count > "5") ### however many files you want to remember. { shift(@recentFiles); } } ### do your menu here, using @recentFiles } -----Original Message----- From: A [mailto:pri...@se...] Sent: Wednesday, April 11, 2001 3:30 PM To: per...@li... Subject: [perl-win32-gui-users] Most-Recently-Used files Hi, Does anybody have an idea how to implement a Most-Recently- Used files (last used files)? It is mostly in File menu. I mean similar to MS WORD, MS EXCEL, COREL and many other applications. Thanks Ladislav ------- End of forwarded message ------- _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: <se...@la...> - 2001-04-12 13:21:29
|
Look in podview.pl, in the samples directory that comes with the zip file, for code that implements such a menu. (Although I've never used this code, I noticed the feature when I was looking through the samples.) If you got Win32::GUI by PPM from ActiveState, you probably don't have this directory. I highly recommend getting the zip file just for this directory, even if you are not going to build Win32::GUI yourself. > I'd simply write the path\file to a data file somewhere and read it > before you contruct your menu. You would write to this file every time > someone opens or creates a file. You would probably also want to > create a subroutine that limits how many files are kept, as such: |
From: Peter E. <Pet...@at...> - 2001-04-12 15:29:59
|
Took a peek at podview.pl. Instead of a datafile it uses the registry. It also uses a hash instead of an array, so duplicates don't exist (if you open the same file multiple times). Good call, this is a better way to handle it, assuming the person using it is careful with the registry. -----Original Message----- From: se...@la... [mailto:se...@la...] Sent: Thursday, April 12, 2001 9:20 AM To: per...@li... Subject: RE: [perl-win32-gui-users] Most-Recently-Used files Look in podview.pl, in the samples directory that comes with the zip file, for code that implements such a menu. (Although I've never used this code, I noticed the feature when I was looking through the samples.) If you got Win32::GUI by PPM from ActiveState, you probably don't have this directory. I highly recommend getting the zip file just for this directory, even if you are not going to build Win32::GUI yourself. > I'd simply write the path\file to a data file somewhere and read it > before you contruct your menu. You would write to this file every time > someone opens or creates a file. You would probably also want to > create a subroutine that limits how many files are kept, as such: _______________________________________________ Perl-Win32-GUI-Users mailing list Per...@li... http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users |
From: Peopleclick C. S. <Peo...@pe...> - 2001-04-12 16:48:43
|
Just as an fyi, most products use the registry for this. If you open regedit and search for MRU, you will find the general structure most apps use in the registry for this. Technically, all you really need to do is to create a new hive for your product under hklm\software\yourcompanyorappname\MRU\ and then have each file as a separate value. Most companies use the HKU hive, but it requires more effort on your part to get the username and resolve that to subhive of HKU. Either way you want to go, unless there are some VERY tight security, the registry is the "proper" way to store this sort of thing instead of a file. =20 Joe Frazier, Jr Technical Support Engineer Peopleclick.com 800-841-2365 su...@pe... > -----Original Message----- > From: Peter Eisengrein [mailto:Pet...@at...] > Sent: Thursday, April 12, 2001 8:46 AM > To: 'per...@li...' > Subject: RE: [perl-win32-gui-users] Most-Recently-Used files >=20 >=20 > I'd simply write the path\file to a data file somewhere and=20 > read it before > you contruct your menu. You would write to this file every=20 > time someone > opens or creates a file. You would probably also want to=20 > create a subroutine > that limits how many files are kept, as such: >=20 > ### untested! >=20 > ### At the beginning of the script this sub would get called like > &recentFilenames(); >=20 >=20 > ### during your open file sub do something like this. $file =3D=20 > the file you > just opened=20 > &recentFilenames(open,$file); >=20 >=20 > ### > sub recentFilenames > { > my ($what,$file) =3D @_; > if ($what eq "open") > { > open(FILE,">>$recentFiles"); > print FILE "$file\n"; > close(FILE); > push(@recentFiles,$file); > shift(@recentFiles); > } > else > { > open(FILE,"$recentFiles"); > @recentFiles=3D<FILE>; > close(FILE); >=20 > $count=3D@recentFiles; > while ($count > "5") ### however many files=20 > you want to > remember. > { > shift(@recentFiles); > } >=20 > } >=20 >=20 > ### do your menu here, using @recentFiles >=20 > } >=20 >=20 > =09 >=20 > -----Original Message----- > From: A [mailto:pri...@se...] > Sent: Wednesday, April 11, 2001 3:30 PM > To: per...@li... > Subject: [perl-win32-gui-users] Most-Recently-Used files >=20 >=20 > Hi, > Does anybody have an idea how to implement a Most-Recently- > Used files (last used files)? > It is mostly in File menu. > I mean similar to MS WORD, MS EXCEL, COREL and many other=20 > applications. > Thanks >=20 > Ladislav >=20 >=20 >=20 > ------- End of forwarded message ------- >=20 > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >=20 > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Per...@li... > http://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users >=20 |