Global variables/constants in 3.18/libs/examples

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
2 posts • Page 1 of 1
Stijns
Posts: 2
Joined: Tue Jun 04, 2019 10:50 am

Global variables/constants in 3.18/libs/examples

Post by Stijns »

Hi,

In our projects we use the Hungarian Notation. Very often we would for example use the variable 'iTimeOut', however this constant seems to be defined in the example libraries (along with several other constants and globals). Specifically, the 'Grid spinBox properies' mentioned in scripts\libs\examples\popupMenu.ctl are also causing problems in our project.

scripts\libs\examples\opcuaImportExample.ctl

Code: Select all

const int iMaxDPEs = 32000; //limit of elements before splitting a DPT
const int iTimeOut = 20*60; //20 minutes maximal waiting time for OPC UA browsing result

const string dbgLevel_OPCUA = "OPCUA_IMPORT_EXAMPLE"; //debug level
const int dbgLevel = 10; // debug level for DebugFTN calls

const int INDEX_DISPLAYNAME = 1;
const int INDEX_BROWSPATH   = 2;
const int INDEX_NODEID      = 3;
const int INDEX_NODECLASSES = 4;
const int INDEX_DATATYPES   = 5;
const int INDEX_ACCESSLEVEL = 6;
scripts\libs\examples\popupMenu.ctl

Code: Select all

// Labels and Icons for top header
global dyn_string columnBlockNames;
global dyn_string columnBlockIcons;
global dyn_string columnNames;
global dyn_string columnIcons;

// Some constant sizes
global const int GRID_SPACE_WIDTH    = 21;
global const int GRID_SPACE_HEIGHT   = 12;
global const int GRID_MINIMUM_HEIGHT = 50;

// Labels, index and DPEs for devices
global dyn_string dsLeftTexts = makeDynString("belt", "belt", "heater", "heater", "heater");
global dyn_string dsLeftNumbers = makeDynString("1", "2", "1", "2", "3");
global dyn_string dpeDevices = makeDynString("testDP1", "testDP2", "testDP2", "testDP3", "testDP4", "testDP5");

// User adjusteblae labels, index and DPEs for devices
global dyn_string rowNames;
global dyn_string rowIndices;
global dyn_string rowDpes;

// Main window properties
global int windowSizeX, windowSizeY;
global string nameMainModule,
              nameMainPanel;

// Define Menu labels and icons
global dyn_string menuHeaders;
global dyn_dyn_string menuLabels, menuIcons;

// Contains main window shape
global shape mainShape;

// Define Grid cell icons and panels
dyn_dyn_string ddsSymbolsToUse;

// Entries for menu items
global dyn_mapping dmIfItems;
const string KEY_TEXT  = "text";
const string KEY_ITEMS = "items";
const string KEY_ICON  = "icon";
global dyn_int diSelection = makeDynInt(1, 1);

// Grid spinBox properies
global dyn_int diRowHeight, diColWidth;
global dyn_bool dbVisibleColums, dbVisibleRows;
global dyn_int diWidth, diHeight;
Although I support including example libraries, I do think these should not 'interfere' with running code in any possible way. A definition of such constant as 'iTimeOut' can possible disrupt code. Could you consider including these examples in such way (or online) that these can't unintentionally affect code of WinCC OA users?

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: Global variables/constants in 3.18/libs/examples

Post by leoknipp »

In a runtime UI the example libraries are not loaded. Therefore, the definition of these variables should not interfere existing code in the application.

Best Regards
Leopold Knipp
Senior Support Specialist

Post Reply
2 posts • Page 1 of 1