[solved] TDBEdit and EditMask lazarus / 16-Databases ---------------------------------------------------------------------- patyi · 2014-01-29 20:39 Dear all ! I have a little problem with EditMask properties. 1. Where is the best place to defining EditMask ? On dataset (ZQuery fields) or on TDBEdit controlls or on both ? 2. the EditMask work properly on String fields :     If field is for example VARCHAR(30), EditMask is '00.000;1;_', is correctly 5 chars is allowed.     But the EditMask is not working properly on INTEGER fields - for example if EditMask is '000;1;_' not just 3 number is allowed but you can      enter any number of char ! What can i do ? It is a bug or I miss something ? Thanks Lazarus 1.3 SVN GTK-2, FPC 2.6.3 SVN, Zeos 7.1.2, Firebird 2.5.2, XUbuntu 13.10 i386 ---------------------------------------------------------------------- taazz · 2014-01-29 20:50 make sure that you set the integer fields max value property to 999 as well. ---------------------------------------------------------------------- patyi · 2014-01-30 11:52 Thanks taazz, Unfortunately the setting the fields MaxValue = 999 and (or) TDBEdit.MaxLength = 3 is not solve the problem ! MaxValue = 999 is correctly call the exception if the value is greater then 999, but I want to prevent this before posting data. TDBEdit.MaxLength = 3 is ignored on non string fields at least on my opinion. I still can enter more then 3 numbers. I know, I can write a workaround using OnChange or OnEditingDone ..., but it should bee a cleaner way ! Thanks. ---------------------------------------------------------------------- patyi · 2014-01-30 12:14 Found a solution ! Fields EditFormat and (or) DBEdits EditMask must bee empty and DBEdit.MaxLength = 3 allowing only 3 numbers ! If I set any of EditFormat or EditMask or both the DBEdit.MaxLength = 3 is ignored and can enter more then 3 numbers !!! ---------------------------------------------------------------------- mangakissa · 2014-01-30 12:50 But DBEdit.MaxLength is set by tfields.size which is set in your table definitions of your table. ---------------------------------------------------------------------- patyi · 2014-01-30 14:36 mangakissa, Yes you are right, initially when you defining data link for TDBEdit the MaxLengt is set to TFields.size, but you can change it on design or run time. For me this solution is OK.