Stupid perl Tkx tricks, part 1 in an ongoing series: Tkx::tk___dialog

I'll drop snippets of code here when I get stuff to work.

I've been programming desktop tools with perl/Tkx for work. I know that some may call me insane for doing so, but I am fairly well versed with the language, and I like how it allows me (most of the time) to get stuff done, instead of fighting me. For the Tkx part of my work, I've been leaning heavily on Tk Docs.

While Tk docs is a GREAT resource (and I'll be sending this post to the maintainer of it), it is far from complete. Today, it was "the standard dialog boxes that I've found are not sufficient for my needs".

To expand: I needed a dialog that had 3 buttons titled "Yes", "No", and "Yes to All". None of the standard dialogs have this. The closest uses "Cancel" as the third button, which, while it would *work*, I think that it isn't really nice to treat the user that way. Or teach them bad habits.

Since Tkx is basically (by my understanding) translating Tkx specific perl directly to Tk commands, most (if not all) of the Tk reference commands should work. I found that you can make custom dialog boxes with buttons that return numbers corresponding to their position in the list with Tk, using Tk_dialog. To implement this with Tkx in perl, I used the following

use strict;
use Tkx;
my $user_response = Tkx::tk___dialog(
    "[window name]",
    "[window title]",
    "[text in body of dialog]",
    "[tk bmp library icon (may be left empty)]",
    "[default button (may be left empty)]",
    "[button 0 text]",
    "[button 1 text]",
    "[button n text]",

$user_response will return a number corresponding with the button number. The dialog box *does not* blend well with the OS widget set, at least with ActivePerl 5.10 on Win32. The icon (if you use one. I haven't dug for a list of icons yet) is a black and white icon, and the font used in the body text does not match what is used everywhere else. The *buttons* do use the proper widget settings, however.