Package: gtk

Function gtk:file-chooser-current-name

Lambda List

gtk:file-chooser-current-name (chooser)

Syntax

(gtk:file-chooser-current-name chooser) => name
(setf (gtk:file-chooser-current-name chooser) name)

Arguments

chooser -- a gtk:file-chooser widget
name -- a string with the filename to use, as a UTF-8 string

Details

The gtk:file-chooser-current-name function gets the current name in the file selector, as entered by the user in the text entry for "Name". The (setf gtk:file-chooser-current-name) function sets the current name.

This is meant to be used in save dialogs, to get the currently typed filename when the file itself does not exist yet. For example, an application that adds a custom extra widget to the file chooser for "file format" may want to change the extension of the typed filename based on the chosen format, say, from ".jpg" to ".png".

Note that the name passed in here is a UTF-8 string rather than a filename. This function is meant for such uses as a suggested name in a "Save As..." dialog. You can pass "Untitled.doc" or a similarly suitable suggestion for the name.

If you want to preselect a particular existing file, you should use the gtk:file-chooser-file function instead. Please see the documentation for this function for an example of using the gtk:file-chooser-current-name function as well.

Warning

The gtk:file-chooser implementation is deprecated since 4.10. Use the gtk:file-dialog object instead.
 

See also

2024-4-26