If you need to use MaxBase as it is, adding only a couple of features (like spawning an external MIDI player when the user selects an entry in a MIDI database) you can make use of plugins. A plugin is, visually, an external frame that appears after one or more records have been selected and the user launched the plugin via a MaxBase menu item. Developing the frame is up to the programmer, while the menu item is to be added by the user from the main MaxBase user interface.
Basically a plugin is a program that, after initializing itself, gets from the caller (MaxBase) all the information it needs to do calculations and other mundane tasks. A Java or NetRexx class becomes a plugin after having implemented the MBPlugin interface, that is composed only by this method:
public void setData(String[][] sRecordStr, String[][] sRecordArr)
The first parameter brings field information data, while the second brings records information (records selected by the user when the plugin was launched).
Format for sRecordStr is as follows: [0][0] = total number of fields [field num][0] = field length [field num][1] = field name [field num][2] = field indexing (ISAM00, NONE1, B+TREE11, etc).
Format for sRecordArr is as follows: [0][0] number of records. [field N][record M] is the N-th field for the M-th record.
After the setData method of your plugin has been called, you can assume that nothing else from MaxBase will come, and therefore you can proceed with the actual plugin program flow. |