Display Number

(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.

VC EXPRESS Project files

Here are the entire project folder

DisplayNumber.zip

It contain three files :

  • DisplayNumber.h
  • DisplayNumber.cpp
  • DisplayNumber.vcproj

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’.

Overview

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’.

Edit layout functionalities

To manage it with the SDK, there is three things we have to do :

  • Construct the ‘edit layout’ panel and provide it to Usine.
  • Listen Usine to layout parameters modifications and reflect them in the module.
  • Draw the module interface upon these parameters.

Layout panel construction

 
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);

Layout parameters modifications

 
void LayoutHasChanged(void* pModule);
 
// to ask usine to update the module panel
 
void RepaintPanel(TMasterInfo* pTMasterInfo);

Drawing the module interface

 
void Paint (void* pModule, HDC DC, DWORD ParentColor);
 
sdk/modules/display_number.txt · Last modified: 2013/04/19 02:22 (external edit)