How to create a new module
UM1743
38/111
DocID026161 Rev 4
Then, each module has its own Startup function which simply consists of the graphical
module creation, initialization and link to the main callback:
In the example above cbDialog refers to the main module callback routine. Its general
skeleton is structured like the following:
The list of windows messages presented in the code portion above (WM_INIT_DIALOG and
WM_NOTIFY_PARENT) is not exhaustive, but represents the essential message IDs used:
•
"WM_INIT_DIALOG: allows initializing the graphical elements with their respective
initial values. It is also possible here to restore the backup parameters (if any) that will
be used during the dialog procedure.
•
"WM_NOTIFY_PARENT: describes the dialog procedure, for example: define the
behavior of each button.
The full list of window messages can be found in the WM.h file.
4.4
Adding a module to the main desktop
Once the module appearance and functionality are defined and created, it still only to add
the module to the main desktop view, this is done by adding it to the list (structure) of menu
items: module_prop[ ], defined into k_module.h.
To do this, k_ModuleAdd() function should be called just after the module initialization into
the main.c file.
Note that the maximum modules number in the demonstration package is limited to 15; this
value can be changed by updating MAX_MODULES_NUM defined into k_module.c.