Documentation‎ > ‎Menus‎ > ‎


A menu item which provides a list of all recently opened files as monitored by the system recent chooser manager.


gnocl::menuRecentChooser [-option value...]



type: string (default: "*")
List of file patterns to use in ordert to filter the list of filenames disiplayed. e.g "*.c *.h".
type: string (defaul: "none")
Determine the ordering of the items displayed based upon the frequency of use. The availalble option are none (i.e. by time), least or most..
type: integer (default: 10)
The maximum number of recently opened files to be displayed. Using a value of -1 will result in the display of all items..
type: boolean (default: 1)
Whether or not to display a file icon registered as corresponding to the extension of a displayed item.
type: boolean (default: 1)
Whether or not to show the names of items no longer present. Setting this item to 0 will result in a check on every available resource (including remote devices) and so will be a time consuming activity.
type: boolean (default: 1)
Whether the menu items are prepended by a number acting as keyboard mneumonic.
type: boolean (default: 1)
Whether or not the item is sensitive to user only show local items.
type: boolean (default: 0)
Whether or not private items are to be displayed.
type: boolean (default: 1)
Whether or not to show a tooltip containing the full path of the active item.
type: string (default: "")
Tcl script which is executed whenever the mouse pointer enters the button. Before evaluation the following percent strings are substituted:

%w    widget name
%f      URI of file entry selected.

Local files will be prefixed with "file://" which may need to be removed for use in scripts. See the example below for more details.


A menu that displays a list of those files listed by the Gtk recent file manager as being opened. The items displayed can be filtered according to application requirements. Items are added/removed using an instance of the gnocl::recentManager widget.


id delete
Deletes the widget and the associated tcl command.
id configure [-option value...]
Configures the widget. Option may have any of the values accepted on creation of the widget.


# test-recent.tcl
exec tclsh "$0" "$@"

package require Gnocl

set txt [gnocl::text]
set box [gnocl::box -orientation vertical]

set tbar [gnocl::toolBar]

$box add $tbar
$box add $txt -fill {1 1} -expand 1

set rc_mgr [gnocl::recentManager getDefault]
set rc_menu [gnocl::menuRecentChooser \
    -showNumbers 1 \
    -limit 5 \
    -showIcons 1 \
    -showNotFound 1 \
    -showPrivate 1 \
    -showTips 1 \
    -patterns "*.tcl *.c *.h" \
    -onClicked {
        set fname [string range %f 5 end]
        openFile $fname
        } ]

$tbar add menuButton \
    -icon %#Open \
    -text Open \
    -menu $rc_menu \
    -tooltip "Open File" \
    -arrowTooltip "Open Recent" \
    -onClicked {
        set fname [gnocl::fileChooserDialog]
        openFile $fname
        puts "file://$fname"
        $rc_mgr add "$fname"

proc openFile {fname} {
    global txt
    global rc_mgr
    if {$fname == ""} {return}
    if {1} {
    set fp [open $fname "r"]
    set data [read $fp]
    close $fp
    $txt set $data
    unset data

gnocl::window -child $box -setSize 0.3

Working with Filefilters

If an application has a variable setting for its associated filetypes as used in the gnocl::fileChooserDialog, then its valuies can be used to set the -patterns option. For example:

set ::app(fileFilters)  { Data {*.dat *.DAT} Text {*.txt *.TXT} }
foreach {a b} $::app(fileFilters) { append patterns $b }