# IupConfigRecentInit

Definition: | include pGUI.e IupConfigRecentInit(Ihandle config, Ihandle menu_list, 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 or list for the application. config: Identifier of the configuration database (see IupConfig) menu_list: 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
pwa/p2js: | Not supported.
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 or list, it is the IupConfig handle. But also inside the callback the IupConfig inherits attributes from the menu as if it was its parent. The recent file list is stored by default in the group "Recent" in the configuration file. To change the default set the internal attribute RECENTNAME, when set all other internal attributes will be stored with this value as a prefix. (since 3.23)
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