/*! \brief Callback on instance destruction
* Callback called when a plugIT instance is destroyed
*
* Prototype: fun [PInstance u0] I
*
* \param PInstance : destroyed plugIT instance
* \param u0 : user parameter, the type is not defined here because it is not used in this template
*
* \return I : 0
**/
fun deleteOb(inst, uparam)=
0;;
// plugIT doing something
fun doSomething(value)=
// test the value to define a default one
let if value == nil then "none" else value -> value in
(
// create a dialog box with the value as text
_DLGMessageBox _channel DMSwin "Template Plugit !!" value 0;
);
0;;
/*! \brief Callback on "Go" dms action
*
* Call the program function to display a dialog box
*
* Prototype: fun [PInstance DMI S S I u0] I
*
* \param PInstance : plugIT instance
* \param DMI : DMS module who call the action (not used)
* \param S : name of the launched action
* \param S : data posted in DMS action link
* \param I : reply flag (not used)
* \param u0 : user parameter, the type is not defined here because it is not used in this template
*
* \return I : 0
**/
fun cbGo(inst, from, action, param, rep, uparam)=
// call the dialog box and set the link parameter as text
doSomething param;
0;;
/*! \brief Callback on new plugIT instance
*
* Read the parameters from editor values and initialise the plugIT
*
* Prototype: fun [PInstance] I
*
* \param PInstance : plugIT instance
*
* \return I : 0
**/
fun newOb(inst)=
// retrieve the oninit param value
let atoi (getPluginInstanceParam inst "oninit") -> state in
(
// define the function to call when we receive the Go action
PluginRegisterAction inst "Go" mkfun6 @cbGo nil;
// test the oninit param to know if we have to start the plugIT functionalities here
if !state then nil else
doSomething nil;
// define the function to call when the plugIT instance is destroyed
setPluginInstanceCbDel inst mkfun2 @deleteOb nil;
);
0;;
/*! \brief Global plugIT function to initialize the plugIT callbacks
*
* called on plugIT load, here define the functions to use for a new instance and the editor
*
* Prototype: fun [s] I
*
* \param S : plugIT file path
*
* \return I : 0
**/
fun IniPlug(file)=
PlugRegister @newOb nil;
setPluginEditor @dynamicedit;
0;;