|
|
(DRAFT)
This user module is a new version of the one provided with Usine. It’s updated to take advantage of ‘edit layout’ functionalities and thus, is a good example for showing how to manage them with the SDK.
Here are the entire project folder
It contain three files :
You just have to unzip it at the same level as examples provided with the SDK. After that, you open the SDK solution, add an existing project and locate the ‘DisplayNumber.vcproj’ file, that’s it
.
if you want to put the project folder elsewhere, you’ll surely have to change the path to retrieve the ‘UserDefinitions.h’.
The goal of this module is pretty simple, you have a numeric value and you want to show it in your interface.
Things become interesting when it’s time to let the user customize the appearance of the module in the interface, it’s the purpose of the ‘edit layout’ panel.
Of course, layout is involved only if the module have a graphical interface. This is decided in the ‘GetModuleInfo()' function, by the value affected to the ‘pModuleInfo→ModuleType’.
To manage it with the SDK, there is three things we have to do :
void CreateLayout(void* pModule);
void AddLayoutLineSeparator(TMasterInfo* pTMasterInfo); void AddLayoutLineColor(TMasterInfo* pTMasterInfo, DWORD* pVal, PCHAR Caption); void AddLineLayoutBoolean(TMasterInfo* pTMasterInfo, LONGBOOl* pVal, PCHAR Caption); void AddLineLayoutInteger(TMasterInfo* pTMasterInfo, int* pVal, PCHAR Caption, int min, int max);
void LayoutHasChanged(void* pModule);
// to ask usine to update the module panel void RepaintPanel(TMasterInfo* pTMasterInfo);
void Paint (void* pModule, HDC DC, DWORD ParentColor);