Best way to populate a recent files popup menu button
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Best way to populate a recent files popup menu button
Hi all,
I have a Mac application that can open files. I would like to add a "recents" popup menu that list the name of the files user opened. When user choose a menu item the file is opened. Some suggestion in how is the best way to accomplish this with LC?
PS
Would be great to be able to add a Clear Recents menu item and a menuitem grey that appairs when there are not recents (No Recents).
I have a Mac application that can open files. I would like to add a "recents" popup menu that list the name of the files user opened. When user choose a menu item the file is opened. Some suggestion in how is the best way to accomplish this with LC?
PS
Would be great to be able to add a Clear Recents menu item and a menuitem grey that appairs when there are not recents (No Recents).
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Best way to populate a recent files popup menu button
Hi mag,
This sounds like a "Preferences" or "Data" file, lots of posts in the forums on that.
Pretty much just write the files names (url's) to an external file and save. Clearing the names I think you'll see is easy.
Write them to another stack seems popular, I like using a text file because they are easy to read.
Simon
This sounds like a "Preferences" or "Data" file, lots of posts in the forums on that.
Pretty much just write the files names (url's) to an external file and save. Clearing the names I think you'll see is easy.
Write them to another stack seems popular, I like using a text file because they are easy to read.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Best way to populate a recent files popup menu button
Hi Simon, thank you so much for the message. Before to store data on disk, I would like to understand what is best to do when I have a file path, how to process it and local store name and path, what kind of container is better to use and hw to populate the menu. Any experience or suggestion on this will be welcome!
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Best way to populate a recent files popup menu button
Hi Mag,
here:
http://forums.runrev.com/phpBB2/viewtop ... ile#p81542
I think the last posting gives you the right info. The only thing I'd change is the open/read/close thing. It's easier just to say "put url("file:"specialFolderPath("Documents") & "/prefs.txt"" into myVar" and read from that. Writing is the same.
Simon
here:
http://forums.runrev.com/phpBB2/viewtop ... ile#p81542
I think the last posting gives you the right info. The only thing I'd change is the open/read/close thing. It's easier just to say "put url("file:"specialFolderPath("Documents") & "/prefs.txt"" into myVar" and read from that. Writing is the same.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Best way to populate a recent files popup menu button
Thank you Simon, and how do you usually handle the populating of menu items?
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Best way to populate a recent files popup menu button
For a Open Recent File you'd have to either set a max number of items or build on the fly.
The items are just buttons all grouped together.
and for the button
I guess you'd have to make myVar a global.
Simon
EDIT: I suppose it could just be a list and not actual buttons.
The items are just buttons all grouped together.
Code: Select all
set itemDel to "/"
set the label of button "3rdchoice" to the last item of line 3 of myVar --line 3 contains the url to file
Code: Select all
put line 3 of myVar into tDoc
launch document tDoc
Simon
EDIT: I suppose it could just be a list and not actual buttons.
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: Best way to populate a recent files popup menu button
Thank you for the post. Actually I don't need to store the info between sessions. Anyway thank you for the info.
I noticed that if I want to set a menuitems like these:
http://www.apple.com
http://www.apple.com/iphone
I get these:
http:/www.apple.com
http:/www.apple.comiphone
I noticed that if I want to set a menuitems like these:
http://www.apple.com
http://www.apple.com/iphone
I get these:
http:/www.apple.com
http:/www.apple.comiphone
Re: Best way to populate a recent files popup menu button
HI Mag,
since the SLASH is used as a delimiter for menu shortcuts, you have to ESCAPE (= replace ) the SLASHES like this:
...
http:\/\/www.apple.com
http:\/\/www.apple.com\/iphone
...
Best
Klaus
since the SLASH is used as a delimiter for menu shortcuts, you have to ESCAPE (= replace ) the SLASHES like this:
...
http:\/\/www.apple.com
http:\/\/www.apple.com\/iphone
...
Best
Klaus
Re: Best way to populate a recent files popup menu button
Thank you.
And how I populate the menu via code? Via inspector is easy, I just enter the text, but via code, I don't find the right way in docs.
And how I populate the menu via code? Via inspector is easy, I just enter the text, but via code, I don't find the right way in docs.
Re: Best way to populate a recent files popup menu button
...
set the text of btn "your menu here" to tVar
...
set the text of btn "your menu here" to tVar
...
Re: Best way to populate a recent files popup menu button
YEAH!Klaus wrote:...
set the text of btn "your menu here" to tVar
...
PS
No clickable emoticons yet
Re: Best way to populate a recent files popup menu button
Thank you so much Simon and Klaus, with your help I done a great implementation of my recents button!