Decimal Separator

Decimal Separator. How to keep ‘Input Masks’ and ‘Display Masks’ in Sync with the Settings of the MS-Windows Operating System
 
The country & language settings of MS-Windows include the setting of the Decimal Separator. For most countries this is either a comma or a dot. WinDev will automatically take care of these setting as long as you define all masks in the control’s Description. WinDev will adapt your exe program to the settings of the computer. However, WinDev will not take care of the decimal separator in case you’re building any masks as strings and feed them to the control by using the ..mask property! A mask defined as a string like
 
MyMask is string = “999999.999” and the subsequent feed to an edit control like
MyEdit1..mask = MyMask
 
will inevitably fail if the Windows setting for the decimal separator is a comma !!
 
The only way to get things straight is to read the decimal separator string from the Windows settings and to build the string like MyMask is string = “999999”+DecimalSeparator+”999”  So, to make your programs internationally usable, take care of all mask strings in your software!
 
A short procedure (taken from the Wind’Asso web site http://www.windasso.org/cgi-bin/gespage.exe?exec=index&lg=gb ) helps in retrieving the Decimal Separator :
 
PROCEDURE DecimalSeparator()
MAX_BUFFER_SIZE is short int=100
LOCALE_USER_DEFAULT is long int=1024
LOCALE_SMONDECIMALSEP is long int=22
 
mApiReturn is long int
mBuffer is string
mBufferSize is long int
 
mBuffer = RepeatString(Charact(0),MAX_BUFFER_SIZE)
mBufferSize = MAX_BUFFER_SIZE - 1
 
mApiReturn = CallDLL32("kernel32","GetLocaleInfoA",LOCALE_USER_DEFAULT,LOCALE_SMONDECIMALSEP,&mBuffer,mBufferSize)
mBuffer = Left(mBuffer,mApiReturn - 1)
 
RESULT mBuffer
 
 
 
 
BuiltWithNOF
[Home] [English] [WX Links] [Deutsch] [Impressum] [Downloads] [RADTranslate] [Upper] [NullValues] [TableOnStructure] [HFClassicHFSQL] [RAD11] [USBFind] [Color Contrast] [Dec. Separator] [Setup Problems] [Directories] [Help Authoring] [Access CHM] [Make GUID] [HOpen Files] [Reset Table] [Int. Gen. Number] [TAB-Control] [fDataDir.. commands] [Calendar Weeks] [Input & check EAN 8/13] [Test_for_Dups] [Feiertage] [MemStick as Dongle] [Get Date & Time] [German phone book]