DbEditMask example: Fix ShortDateFormat, it raised an exception.

git-svn-id: trunk@54833 -
This commit is contained in:
juha 2017-05-08 12:36:51 +00:00
parent 497a08de97
commit 2a1891258d
4 changed files with 12 additions and 15 deletions

View File

@ -12,7 +12,7 @@ object Form1: TForm1
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
OnCreate = FormCreate OnCreate = FormCreate
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.5' LCLVersion = '1.9.0.0'
object Label3: TLabel object Label3: TLabel
Left = 8 Left = 8
Height = 13 Height = 13
@ -68,7 +68,7 @@ object Form1: TForm1
end end
object DateEdit: TDBEdit object DateEdit: TDBEdit
Left = 8 Left = 8
Height = 21 Height = 19
Top = 32 Top = 32
Width = 246 Width = 246
CustomEditMask = True CustomEditMask = True
@ -81,16 +81,16 @@ object Form1: TForm1
end end
object ShowLongDateCheckBox: TCheckBox object ShowLongDateCheckBox: TCheckBox
Left = 270 Left = 270
Height = 19 Height = 21
Top = 32 Top = 32
Width = 92 Width = 112
Caption = 'Show Full Date' Caption = 'Show Full Date'
OnChange = ShowLongDateCheckBoxChange OnChange = ShowLongDateCheckBoxChange
TabOrder = 3 TabOrder = 3
end end
object IntEdit: TDBEdit object IntEdit: TDBEdit
Left = 8 Left = 8
Height = 21 Height = 19
Top = 80 Top = 80
Width = 246 Width = 246
CustomEditMask = True CustomEditMask = True
@ -105,13 +105,13 @@ object Form1: TForm1
Left = 8 Left = 8
Height = 13 Height = 13
Top = 64 Top = 64
Width = 44 Width = 51
Caption = 'AInt Field' Caption = 'AInt Field'
ParentColor = False ParentColor = False
end end
object DBEdit1: TDBEdit object DBEdit1: TDBEdit
Left = 271 Left = 271
Height = 21 Height = 19
Top = 80 Top = 80
Width = 193 Width = 193
CustomEditMask = True CustomEditMask = True
@ -126,7 +126,7 @@ object Form1: TForm1
Left = 270 Left = 270
Height = 13 Height = 13
Top = 64 Top = 64
Width = 85 Width = 100
Caption = 'AStr Field (Phone)' Caption = 'AStr Field (Phone)'
ParentColor = False ParentColor = False
end end

View File

@ -52,7 +52,7 @@ uses
procedure TForm1.FormCreate(Sender: TObject); procedure TForm1.FormCreate(Sender: TObject);
begin begin
ShortDateFormat := 'd/M/yyyy'; DefaultFormatSettings.ShortDateFormat := 'd/m/yyyy';
if not FileExistsUTF8(Dbf1.TableName) then if not FileExistsUTF8(Dbf1.TableName) then
begin begin
Dbf1.FieldDefs.Clear; Dbf1.FieldDefs.Clear;
@ -112,7 +112,7 @@ var
begin begin
DateField := Dbf1.FieldByName('ADate') as TDateTimeField; DateField := Dbf1.FieldByName('ADate') as TDateTimeField;
if ShowLongDateCheckBox.Checked then if ShowLongDateCheckBox.Checked then
DateField.DisplayFormat := LongDateFormat DateField.DisplayFormat := DefaultFormatSettings.LongDateFormat
else else
DateField.DisplayFormat := ''; DateField.DisplayFormat := '';
end; end;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="9"/> <Version Value="10"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
@ -9,9 +9,6 @@
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
</General> </General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1"> <BuildModes Count="1">
<Item1 Name="default" Default="True"/> <Item1 Name="default" Default="True"/>
</BuildModes> </BuildModes>
@ -24,7 +21,7 @@
<RunParams> <RunParams>
<local> <local>
<FormatVersion Value="1"/> <FormatVersion Value="1"/>
<LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local> </local>
</RunParams> </RunParams>
<RequiredPackages Count="3"> <RequiredPackages Count="3">

Binary file not shown.