Definition: |
include pGUI.e
IupConfigRecentInit(Ihandle config, Ihandle menu, cbfunc recent_cb, integer max_recent) |
Description: |
Call IupConfigRecentInit once to initialize the menu.
This function, along with IupConfigRecentUpdate, stores and manages a "Recent Files" menu for the application. config: Identifier of the configuration database (see IupConfig) menu: menu where the recent file items will be listed recent_cb: callback that will be called when a recent file item is selected on the menu max_recent: the maximum number of recent file items |
Callbacks: | |
RECENT_CB |
(as per recent_cb above) Inside the RECENT_CB callback the TITLE attribute contains the filename, but the Ihandle is not the menu, it is the IupConfig handle. But also inside the callback the IupConfig inherits attributes from the menu as if it was its parent. Invoked when an entry on the recent files menu is selected. |
Example: |
function config_recent_cb(Ihandle config) string filename = IupGetAttribute(config, "TITLE") open_file(filename) return IUP_DEFAULT end function Ihandle config = IupConfig() IupSetAttribute(config, "APP_NAME", "MyAppName") if IupConfigLoad(config)!=0 then -- <error handling> end if Ihandle recent_menu = IupMenu({}) -- (as part of menu creation) IupConfigRecentInit(config, recent_menu, Icallback("config_recent_cb"), 10) |
See Also: | IupConfig, IupConfigLoad, IupMenu, IupConfigRecentUpdate |