background image
C H A P T E R 1 9
Built-in Applications and System Data
Icons and the Extras Drawer
19-43
InstallScript := func(partFrame, removeFrame)
begin
local mySlip := GetLayout("MySlip.t") ;
// install the slip
DefGlobalVar (kMyConfigSlipSym, BuildContext(mySlip));
local ed := GetRoot().extrasDrawer;
//Figure out which store our package is in. This code
//will work for a form part, as long as the argument
//to ObjectPkgRef is a reference type (i.e., a
// pointer).
local myStore := GetVBOStore(ObjectPkgRef(mySlip));
//check if our icon is already installed
if Length(ed:GetExtraIcons('ScriptEntry, kPackageName,
myStore)) = 0 then
call kAddExtraIconFunc with
('ScriptEntry,
kScriptIconParamFrame,
kPackageName,
myStore);
end;
RemoveScript := func(removeFrame)
// remove the slip
UnDefGlobalVar(kMyConfigSlipSym);
Note that you do not have to remove the script icon, since it is associated with your
package. When the package is removed, the icon is removed as well. But if you
wish to remove it at some other time, you can do so with a call to the Extras
Drawer method
RemoveExtraIcon
.
Using the Soupervisor Mechanism
19
In order to take advantage of the soupervisor mechanism, you need to do
the following:
1. At build time, add an
ownerApp
slot to your part frame. This slot should be set
to your application symbol. You can do this with a call to
SetPartFrameSlot
,
as in the following code:
call SetPartFrameSlot with ('ownerApp, kAppSymbol);
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна