Platforms to show: All Mac Windows Linux Cross-Platform

MacShowAboutBoxMBS(options as CFDictionaryMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method CoreFoundation MBS MacCF Plugin 9.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Displays an HI-conformant about box.
Example
dim kHIAboutBoxNameKey as CFStringMBS = NewCFStringMBS("HIAboutBoxName")
dim kHIAboutBoxVersionKey as CFStringMBS = NewCFStringMBS("HIAboutBoxVersion")
dim kHIAboutBoxCopyrightKey as CFStringMBS = NewCFStringMBS("HIAboutBoxCopyright")
dim kHIAboutBoxDescriptionKey as CFStringMBS = NewCFStringMBS("HIAboutBoxDescription")
dim kHIAboutBoxStringFileKey as CFStringMBS = NewCFStringMBS("HIAboutBoxStringFile")

dim d as CFMutableDictionaryMBS

d=NewCFMutableDictionaryMBS

// name, version and copyright are optional:
d.add(kHIAboutBoxNameKey, NewCFStringMBS("MyApp"))
d.add(kHIAboutBoxVersionKey, NewCFStringMBS("1.0"))
d.add(kHIAboutBoxCopyrightKey, NewCFStringMBS("© 2009 by Christian Schmitz"))

// description is needed
d.add(kHIAboutBoxDescriptionKey, NewCFStringMBS("The best application I ever made!"))

// optional
'd.add(kHIAboutBoxStringFileKey, NewCFStringMBS("somefile"))

MsgBox Str(MacShowAboutBoxMBS(d))

This about box is a generic about box that automatically can display your application name, version string, and copyright string. It peeks into either the Info.plist (for the CFBundleName, CFBundleVersion, and CFBundleGetInfoString keys) or your bundle resource (not recommended) to get the information by default. You can customize what it displays by passing in various options in the input dictionary. Note that currently the description string can only be specified in the options dictionary; this function does not check your Info.plist for a descriptions string.

There are three basic ways to call this function. First, you can pass nil for inOptions. As mentioned, default information will be displayed. Second, you can pass the actual values for the strings displayed by passing the strings in the inOptions dictionary using the keys provided, such as kHIAboutBoxNameKey. If a replacement string is not passed, the default behavior kicks in. For example, you could pass some variant of your application name in the dictionary, but not pass a replacement version or copyright strings. The Toolbox would display your replacement string, and fall back to looking in the Info.plist for the other strings. The third way to call this is to pass the name of a string file in the dictionary with the key kHIAboutBoxStringFileKey. We will automatically use that file to find the strings for the about box. The keys in the string file should be the same value as the keys you would use to pass into the inOptions dictionary. Again, if a string is not found in that file, we would fall back to looking for a string in the dictionary, and then finally the Info.plist. Certainly this is not the be-all-end-all of about boxes, but it does provide a simple no-work about box for your application. The standard Toolbox application handler now responds to the kHICommandAbout command ID by calling HIAboutBox for you. This means that any Carbon Event-based application will get this behavior for free right out of the box. If you wish for the window to respond to cmd-W in the menu bar, you should make sure that menu item has the kHICommandClose commandID.

Options: A dictionary of replacement strings, or the name of a string file to retrieve the strings from, or nil. See the discussion for how this is used.

Returns a Mac OS error code or -1 if function is not available.
Not supported on 64 bit targets.

Blog Entries

Xojo Developer Magazine

The items on this page are in the following plugins: MBS MacCF Plugin.


The biggest plugin in space...