You've already forked lazarus-ccr
TvPlanIt: Fix FlexDatastore crashing in Access demo when birthdate of a contact is not specified.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8948 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -60,6 +60,7 @@ type
|
||||
cbEMail3: TComboBox;
|
||||
cbWebsite1: TComboBox;
|
||||
edAddressH: TEdit;
|
||||
edAnniversary: TDateEdit;
|
||||
edCityH: TEdit;
|
||||
edCompany: TEdit;
|
||||
edCountryH: TEdit;
|
||||
@ -69,6 +70,7 @@ type
|
||||
gbWorkAddress: TGroupBox;
|
||||
gbHomeAddress: TGroupBox;
|
||||
lblAddressH: TLabel;
|
||||
lblAnniversary: TLabel;
|
||||
lblCityH: TLabel;
|
||||
lblCompany: TLabel;
|
||||
lblCountryComboH: TLabel;
|
||||
@ -229,6 +231,7 @@ begin
|
||||
lblTitle.Caption := RSTitleLbl;
|
||||
lblCategory.Caption := RSCategoryLbl;
|
||||
lblBirthdate.Caption := RSBirthDateLbl;
|
||||
lblAnniversary.Caption := RSAnniversaryLbl;
|
||||
|
||||
lblCompany.Caption := RSCompanyLbl;
|
||||
lblDepartment.Caption := RSDepartmentLbl;
|
||||
@ -278,7 +281,16 @@ begin
|
||||
Contact.FirstName := edFirstName.Text;
|
||||
Contact.Title := edTitle.Text;
|
||||
Contact.Category := cbCategory.ItemIndex;
|
||||
Contact.Birthdate := edBirthdate.Date;
|
||||
|
||||
if edBirthDate.Text = '' then
|
||||
Contact.Birthdate := NO_BIRTHDATE
|
||||
else
|
||||
Contact.Birthdate := edBirthdate.Date;
|
||||
|
||||
if edAnniversary.Text = '' then
|
||||
Contact.Anniversary := NO_ANNIVERSARY
|
||||
else
|
||||
Contact.Anniversary := edAnniversary.Date;
|
||||
|
||||
Contact.Company := edCompany.Text;
|
||||
Contact.Department := edDepartment.Text;
|
||||
@ -352,20 +364,22 @@ begin
|
||||
edLastName.Text := Contact.LastName;
|
||||
edFirstName.Text := Contact.FirstName;
|
||||
edTitle.Text := Contact.Title;
|
||||
if contact.Birthdate = 0.0 then
|
||||
|
||||
if contact.Birthdate = NO_BIRTHDATE then
|
||||
edBirthdate.Clear
|
||||
else
|
||||
edBirthdate.Date := Contact.Birthdate;
|
||||
|
||||
if contact.Anniversary = NO_ANNIVERSARY then
|
||||
edAnniversary.Clear
|
||||
else
|
||||
edAnniversary.Date := Contact.Anniversary;
|
||||
|
||||
cbCategory.Items.Clear;
|
||||
for ct := Low(TVpCategoryType) to High(TVpCategoryType) do
|
||||
cbCategory.Items.Add(CategoryLabel(ct));
|
||||
cbCategory.ItemIndex := Contact.Category;
|
||||
|
||||
if Contact.Birthdate = 0.0 then
|
||||
edBirthdate.Clear else
|
||||
edBirthdate.Date := Contact.Birthdate;
|
||||
|
||||
edCompany.Text := Contact.Company;
|
||||
edDepartment.Text := Contact.Department;
|
||||
edPosition.Text := Contact.Job_Position;
|
||||
@ -528,6 +542,7 @@ begin
|
||||
hBorder := ScaleX(hBorder, DesignTimeDPI);
|
||||
vBorder := ScaleY(vBorder, DesignTimeDPI);
|
||||
edBirthdate.ButtonWidth := edBirthdate.Height;
|
||||
edAnniversary.ButtonWidth := edAnniversary.Height;
|
||||
comboArrowWidth := GetSystemMetrics(SM_CXVSCROLL) * 2;
|
||||
|
||||
for i := 0 to ComponentCount-1 do
|
||||
@ -547,21 +562,24 @@ begin
|
||||
{----------------------------------------------------------------------------}
|
||||
{ Page "Base data" }
|
||||
{----------------------------------------------------------------------------}
|
||||
SetLength(labels, 5);
|
||||
SetLength(labels, 6);
|
||||
labels[0] := lblLastName;
|
||||
labels[1] := lblFirstName;
|
||||
labels[2] := lblTitle;
|
||||
labels[3] := lblCategory;
|
||||
labels[4] := lblBirthdate;
|
||||
labels[5] := lblAnniversary;
|
||||
largestLabelWidth := 0;
|
||||
for i:=0 to High(labels) do
|
||||
largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(labels[i]));
|
||||
edLastName.Left := largestLabelWidth + hlabelDist;
|
||||
|
||||
edBirthdate.Width := edTitle.Width;
|
||||
edAnniversary.Width := edTitle.Width;
|
||||
cbCategory.Width := edTitle.Width;
|
||||
{$IFDEF NEW_ICONS}
|
||||
LoadGlyphFromRCDATA(edBirthDate.Button.Glyph, 'VpDateEdit', 16, 24, 32);
|
||||
LoadGlyphFromRCDATA(edAnniversary.Button.Glyph, 'VpDateEdit', 16, 24, 32);
|
||||
{$ENDIF}
|
||||
|
||||
{----------------------------------------------------------------------------}
|
||||
|
Reference in New Issue
Block a user