background image
C H A P T E R 1 9
Built-in Applications and System Data
Icons and the Extras Drawer
Creating a Script Icon
Installation of a script icon is basically the same as that for a soup icon. The two
main differences are that the symbol
is passed in for the iconType
parameter of
, and the paramFrame argument contains different
slots. However, with a script icon it is not important to keep this icon in the internal
store. Instead, you should ensure that the icon is installed on the same store as the
package with which it is associated.
The most likely use for a script icon is for a transport to bring up an interface for
user preferences. The code sample shown below brings up a such a slip:
//Useful constants.
Intern("configSlip:" & kAppSymbol));
constant kScriptIconName
:= "ScriptIcon Slip";
constant kScriptIconPkgName:= Intern ("Script:" &
// get the icon picture
r := OpenResFileX(HOME & "pictures");
DefConst('kMyScriptIcon, GetPictAsBits("TARDIS", nil));
// the tap action, small and simple
DefConst('kTapScript, func()
GetGlobalVar(kMyConfigSlipSym):Open() );
// name in the Extras Drawer
text: kScriptIconName,
// icon in the Extras Drawer
icon: kMyScriptIcon,
// to allow access via SetExtrasInfo
// function to call when icon is tapped
tapAction: kTapScript
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна