B4J Library [class] Recent Files Manager

Erel

Administrator
Staff member
Licensed User


A simple class that manages the list of recent files.
You can set the maximum number of recent files. The default is 5.

Depends on: B4XCollections and JavaObject.

Usage instructions:

1. Call xui.SetDataFolder to set the default files folder:
B4X:
xui.SetDataFolder("FormsBuilder")
2. Initialize the object:
B4X:
RecentManager.Initialize(Me, "Recent", MenuBar1.Menus.Get(0))
The third parameter is the "files" menu.
The manager will add and remove the recent files menu items as needed.

3. Whenever you want to add a file to the recent files list:
B4X:
RecentManager.AddFile(f)
This will usually happen when the user loads a file or "saves as" a file.

4. Save the list of files when the program ends:
B4X:
Sub MainForm_Closed
   RecentManager.SaveList
End Sub
Updates

v1.01 - Files are checked for existence when the list is loaded.
Top item is the most recently used file.
 

Attachments

Last edited:
Top