Author Topic: Module Unload : Automated Toolbar Removal : Request for defunload() macro  (Read 1883 times)


  • Senior Community Member
  • Posts: 115
  • Hero Points: -17
Is there a logical opposite to the defload() command - that can clean up
during a Slickedit module unload operation? 

USE CASE : Remove custom toolbars and other stuff - defined in a Slickedit module (*.e).

Discussion : Example of 60 or more custom SE toolbars - that clutter up the toolbar list.

I use grep toolbars in Slickedit - where the toolbar buttons 'grep'
postfix tags such as _str (STRing),.  _evt (EVenT), _dba (DataBase
Account), etc.

I have a lexicon of over 500 tags - that are used in various code domains
such as database, GUI, threading, abstraction, synchronicity, networking,
XML, XMAL, etc, etc, etc. 

I need to remove toolbars - specific to working in some code domain - when
I unload a module - specific to working in some code domain.

Is there an existing macro that is called - when a module is unloaded -
like defload()? I looked in the Beta 6 help - but did not find any.

Could Slickedit provide a clean up function - that would be at the end of
SE module (*.e) - that could be called when the module was unloaded via
the GUI?  (see attached code module example - defload() at the end). 

This clean up function (defunload) - would help to remove the toolbar
clutter automatically - when I switch out of some code domain - and I load
a new SE code domain module - that has toolbars designed for its relevant
code artifacts - that I am currently dealing with.

Also, I looked in the SE Help on unload(), gui_unload() - and this
functionality is not either. I am fine with a GUI based unload of some SE
module - and a GUI based load of some SE module - when I move between
various code domains (in programming).

The example defunload() function (as described herein) - is a clean up
function - of the SE module (*.e) - that can contain the specific code -
to remove toolbars from the SE environment - in an automated manner -
when the SE module is unloaded via the GUI interface (ie; Menu -> Macro
-> Unload Module).

As it stands now - I have to remove toolbars manually via the GUI - after
the module is unloaded. It would be faster - if this was automated when
the module was unloaded - during the GUI based Unload Module operation.

Loading and unloading SE code domain modules (as I call them) - is a great
way to keep the SE console and environment - clean and uncluttered -
relative to the large number of code domains I use. 

I have attached some screen shots - and an example code domain module
(*_ref_MOD.e) - as use case examples - for the context of the feature
request.  Note the attached code module is in development (not in final

I would like to put a defunload() section in the attached module - that
removes the defined toolbars (and everything else) - from the Slickedit
environment. Note that sometimes I leave macros in - and just remove
the toolbars. Thus the defunload() mechanism gives me great flexibility
to define the SE module unload operation clean up operation.


  • Senior Community Member
  • Posts: 2656
  • Hero Points: 331
You can use _on_unload_module_your_cleanup(_str filename)

Code: [Select]
_command void unload(_str filename='', boolean quiet=false) name_info(MODULE_ARG',')
   filename=prompt(filename,'Unload module');

   // notify callbacks of pending unload
   call_list("_on_unload_module_", filename);