The following is a code snippet of how this can be done, catering for both scenarios mentioned above:
#DEFINE.AUTO('Auto')
#AOT
#PROPERTIES
#WinAPI // Used for regional settings
TreeNode treeNode;
Int decimalPlaces;
;
treeNode = infolog.findNode(#ExtendedDataTypesPath + '\\' + identifierstr(YourEDT));
if (findproperty(treeNode.AOTgetProperties(),#PropertyNoOfDecimals) == #AUTO)
{
  // get the number of decimals from the regional settings
  decimalPlaces = str2int((WinAPI::getLocaleInfo(#LOCALE_USER_DEFAULT,   #LOCALE_ICURRDIGITS)));
}
else
{
  // get the number of decimals set by the developer in the property inspector
  decimalPlaces = str2int(findproperty(treeNode.AOTgetProperties(),#PropertyNoOfDecimals));
}
info (int2str(decimalPlaces));
If you any questions or comments e-mail me on: mirko@mirkobonello.com
No comments:
Post a Comment