DADiSP Worksheet Functions > Function Categories > Worksheet Control > $INITWKS
A macro that automatically executes after the Worksheet is loaded
#DEFINE $INITWKS body
body - an expression to execute when the Worksheet is unloaded.
#define $initwks toolbar(1, -1, 4, "Noise", "rand(10)")
#define $deinitwks toolbar(1, -1, 8)
Defines $INITWKS to add a button to the main toolbar that creates a 10x10 array of random noise. Because the $INITWKS macro is saved with the Worksheet, the toolbar button will be added when the Worksheet is loaded.
$DEINITWKS is defined to remove the added button. Because the $DEINITWKS macro is saved with the Worksheet, the added toolbar button will be removed each time the Worksheet is unloaded.
$INITWKS and $DEINITWKS allow a Worksheet to be dynamically customized.
$INITWKS executes after the Worksheet has been drawn. See $PREINITWKS to execute a macro before the Worksheet is drawn.
Any valid expression, including SPL routines, can be assigned to $INITWKS and $DEINITWKS.
See $DEINITWKS for a macro that executes when a Worksheet is unloaded.