FBox(3pm)

πŸ’– NAME πŸ’–

Tk::FBox β€” a file dialog, bestie. yes it's giving file-picker realness ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

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

🌸 DESCRIPTION 🌸

Okay so Tk::FBox is the dialog implementation lurking behind the getOpenFile, getSaveFile, and chooseDirectory method calls in the Unix/X11 world. Like, it's the main character behind the scenes πŸ‘‘. Because of that, it supports all the options those methods take, plus these extra ones:

  • -sortcmd => sub { $_[0] cmp $_[1] } β€” you're specifying a callback that changes how the icons get sorted in the IconList widget. By default, perl's cmp operator is what's doing the sorting, no cap.

Straight from the source code, and I quote:

# 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! πŸ’€ proceed with caution, bestie.
  • -type => $type β€” this one's the vibe check on what you're picking. It should be open for choosing existing files to open (that's the default, iykyk), save for choosing existing or non-existing files to save, or dir for choosing directories. πŸŽ€
  • -filter => $glob β€” a file glob that restricts which files get displayed. Heads up though: this is only active if there are no -filetypes defined. 🌈
  • -force => $bool β€” if it's true, then there will be no dialog if a file already exists. it just... does the thing. πŸ™ˆ

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 <srezic@cpan.org>.

⭐ SEE ALSO ⭐

Tk::getOpenFile, Tk::IconList.


and that's the whole page, bestie 🫢 this is FBox(3pm) from the User Contributed Perl Documentation collection β€” perl v5.40.1, dated 2025-04-13. slay, go pick some files πŸ’…βœ¨

πŸ“¦ where this page comes from