FBox(3) User Contributed Perl Documentation FBox(3)

# [NAME](#NAME)

Tk::FBox - a file dialog

# [SYNOPSIS](#SYNOPSIS)

```
    use Tk::FBox;
    $file = $mw->FBox(...)->Show;
```

# [DESCRIPTION](#DESCRIPTION)

"Tk::FBox" is the dialog implementation behind the "getOpenFile", "getSaveFile", and "chooseDirectory" method calls in the Unix/X11 world. As such, it supports all options for these methods and additionally:

[-sortcmd =&gt; sub { $\_\[0\] cmp $\_\[1\] }](#sortcmd)

Specified a callback for changing the sorting of the icons in the "IconList" widget. By default, perl's "cmp" operator will be used.

From the source code:

```
  # Using -sortcmd is really strange :-(
  # $top->getOpenFile(-sortcmd => sub { package Tk::FBox; uc $b cmp uc $a});
  # or, un-perlish, but useable (now activated in code):
  # $top->getOpenFile(-sortcmd => sub { uc $_[1] cmp uc $_[0]});
    
```

This is an experimental option!

[-type =&gt; $type](#type)

Type should be "open" for choosing existing files to open (default), "save" for choosing existing or non-existing files to save, or "dir" for choosing directories.

[-filter =&gt; $glob](#filter)

A file glob to restrict displayed files. This is only active if no **-filetypes** are defined.

[-force =&gt; $bool](#force)

If true, then there will be no dialog if a file already exists.

# [COPYRIGHT](#COPYRIGHT)

The original tkfbox.tcl from Tcl/Tk is:

Copyright (c) 1994-1996 Sun Microsystems, Inc.

See the file "license.terms" for information on usage and redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES.

Translated to Perl/Tk by Slaven Rezic &lt;srezic@cpan.org&gt;.

# [SEE ALSO](#SEE_ALSO)

Tk::getOpenFile, Tk::IconList.

2026-10-25 perl v5.44.0

---

Document: Tk::FBox(3pm) from perl-tk 804.036-r12 (Chainguard OS)
Source: https://github.com/eserte/perl-tk
