tvplanit: Fix contact editor form size in Linux.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6488 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-06-12 09:22:39 +00:00
parent dcffe6f0aa
commit 7b04d530a6
4 changed files with 153 additions and 109 deletions

View File

@ -1,7 +1,7 @@
object ContactEditForm: TContactEditForm object ContactEditForm: TContactEditForm
Left = 479 Left = 397
Height = 610 Height = 610
Top = 165 Top = 158
Width = 506 Width = 506
HorzScrollBar.Page = 432 HorzScrollBar.Page = 432
VertScrollBar.Page = 320 VertScrollBar.Page = 320
@ -9,20 +9,19 @@ object ContactEditForm: TContactEditForm
Caption = 'ContactEdit' Caption = 'ContactEdit'
ClientHeight = 610 ClientHeight = 610
ClientWidth = 506 ClientWidth = 506
Constraints.MinWidth = 480
OnCreate = FormCreate OnCreate = FormCreate
OnKeyDown = FormKeyDown OnKeyDown = FormKeyDown
OnShow = FormShow OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
LCLVersion = '1.6.4.0' LCLVersion = '1.9.0.0'
object PageControl: TPageControl object PageControl: TPageControl
Left = 0 Left = 0
Height = 577 Height = 577
Top = 0 Top = 0
Width = 506 Width = 506
ActivePage = tabBaseData ActivePage = tabAddresses
Align = alClient Align = alClient
TabIndex = 0 TabIndex = 1
TabOrder = 0 TabOrder = 0
OnChange = PageControlChange OnChange = PageControlChange
object tabBaseData: TTabSheet object tabBaseData: TTabSheet
@ -54,7 +53,7 @@ object ContactEditForm: TContactEditForm
Height = 23 Height = 23
Top = 8 Top = 8
Width = 384 Width = 384
Anchors = [akTop, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
MaxLength = 100 MaxLength = 100
@ -194,19 +193,19 @@ object ContactEditForm: TContactEditForm
ClientWidth = 498 ClientWidth = 498
ImageIndex = 1 ImageIndex = 1
object gbWorkAddress: TGroupBox object gbWorkAddress: TGroupBox
Left = 8 Left = 24
Height = 298 Height = 298
Top = 8 Top = 8
Width = 482 Width = 466
Align = alTop Align = alTop
AutoSize = True AutoSize = True
BorderSpacing.Left = 8 BorderSpacing.Left = 24
BorderSpacing.Top = 8 BorderSpacing.Top = 8
BorderSpacing.Right = 8 BorderSpacing.Right = 8
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
Caption = 'gbWorkAddress' Caption = 'gbWorkAddress'
ClientHeight = 278 ClientHeight = 278
ClientWidth = 478 ClientWidth = 462
Font.Style = [fsBold] Font.Style = [fsBold]
ParentFont = False ParentFont = False
TabOrder = 0 TabOrder = 0
@ -214,11 +213,11 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = gbWorkAddress AnchorSideTop.Control = gbWorkAddress
AnchorSideRight.Control = gbWorkAddress AnchorSideRight.Control = gbWorkAddress
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 0 Top = 0
Width = 338 Width = 326
Anchors = [akTop, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
MaxLength = 50 MaxLength = 50
OnChange = ItemChanged OnChange = ItemChanged
@ -229,7 +228,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edCompany AnchorSideTop.Control = edCompany
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 59 Left = 55
Height = 15 Height = 15
Top = 4 Top = 4
Width = 65 Width = 65
@ -246,7 +245,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edDepartment AnchorSideTop.Control = edDepartment
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 48 Left = 44
Height = 15 Height = 15
Top = 31 Top = 31
Width = 76 Width = 76
@ -265,10 +264,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 27 Top = 27
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 50 MaxLength = 50
@ -280,7 +279,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edPosition AnchorSideTop.Control = edPosition
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 68 Left = 64
Height = 15 Height = 15
Top = 58 Top = 58
Width = 56 Width = 56
@ -299,10 +298,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 54 Top = 54
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 50 MaxLength = 50
@ -314,7 +313,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edAddressW AnchorSideTop.Control = edAddressW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 69 Left = 65
Height = 15 Height = 15
Top = 85 Top = 85
Width = 55 Width = 55
@ -333,10 +332,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 81 Top = 81
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 100 MaxLength = 100
@ -348,7 +347,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edCityW AnchorSideTop.Control = edCityW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 90 Left = 86
Height = 15 Height = 15
Top = 112 Top = 112
Width = 34 Width = 34
@ -367,10 +366,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 108 Top = 108
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 50 MaxLength = 50
@ -382,7 +381,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edStateW AnchorSideTop.Control = edStateW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 85 Left = 81
Height = 15 Height = 15
Top = 139 Top = 139
Width = 39 Width = 39
@ -401,10 +400,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 135 Top = 135
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 25 MaxLength = 25
@ -416,14 +415,14 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = cbStateW AnchorSideTop.Control = cbStateW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 49 Left = 41
Height = 15 Height = 15
Top = 166 Top = 166
Width = 79 Width = 79
Alignment = taRightJustify Alignment = taRightJustify
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Left = 8 BorderSpacing.Left = 8
BorderSpacing.Right = 4 BorderSpacing.Right = 8
Caption = 'lblStateCombo' Caption = 'lblStateCombo'
FocusControl = cbStateW FocusControl = cbStateW
ParentColor = False ParentColor = False
@ -436,10 +435,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 162 Top = 162
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
ItemHeight = 15 ItemHeight = 15
@ -452,7 +451,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edZipCodeW AnchorSideTop.Control = edZipCodeW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 66 Left = 62
Height = 15 Height = 15
Top = 193 Top = 193
Width = 58 Width = 58
@ -470,7 +469,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = cbStateW AnchorSideTop.Control = cbStateW
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 189 Top = 189
Width = 120 Width = 120
@ -485,7 +484,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = cbCountryW AnchorSideTop.Control = cbCountryW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 28 Left = 24
Height = 15 Height = 15
Top = 220 Top = 220
Width = 96 Width = 96
@ -505,10 +504,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 216 Top = 216
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
@ -523,7 +522,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edCountryW AnchorSideTop.Control = edCountryW
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
Left = 68 Left = 64
Height = 15 Height = 15
Top = 251 Top = 251
Width = 56 Width = 56
@ -542,10 +541,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edCompany AnchorSideRight.Control = edCompany
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 247 Top = 247
Width = 338 Width = 326
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
@ -574,7 +573,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edAddressH AnchorSideTop.Control = edAddressH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edAddressH AnchorSideRight.Control = edAddressH
Left = 69 Left = 65
Height = 15 Height = 15
Top = 4 Top = 4
Width = 55 Width = 55
@ -591,11 +590,11 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = gbHomeAddress AnchorSideTop.Control = gbHomeAddress
AnchorSideRight.Control = gbHomeAddress AnchorSideRight.Control = gbHomeAddress
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 0 Top = 0
Width = 338 Width = 342
Anchors = [akTop, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Right = 8 BorderSpacing.Right = 8
MaxLength = 100 MaxLength = 100
OnChange = ItemChanged OnChange = ItemChanged
@ -606,7 +605,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edCityH AnchorSideTop.Control = edCityH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCityH AnchorSideRight.Control = edCityH
Left = 90 Left = 86
Height = 15 Height = 15
Top = 31 Top = 31
Width = 34 Width = 34
@ -625,10 +624,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edAddressH AnchorSideRight.Control = edAddressH
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 27 Top = 27
Width = 338 Width = 342
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 50 MaxLength = 50
@ -640,7 +639,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edStateH AnchorSideTop.Control = edStateH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edStateH AnchorSideRight.Control = edStateH
Left = 85 Left = 81
Height = 15 Height = 15
Top = 58 Top = 58
Width = 39 Width = 39
@ -659,10 +658,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edAddressH AnchorSideRight.Control = edAddressH
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 54 Top = 54
Width = 338 Width = 342
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
MaxLength = 25 MaxLength = 25
@ -674,7 +673,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = cbStateH AnchorSideTop.Control = cbStateH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = cbStateH AnchorSideRight.Control = cbStateH
Left = 49 Left = 45
Height = 15 Height = 15
Top = 85 Top = 85
Width = 79 Width = 79
@ -694,10 +693,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edAddressH AnchorSideRight.Control = edAddressH
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 81 Top = 81
Width = 338 Width = 342
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
ItemHeight = 15 ItemHeight = 15
@ -710,7 +709,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edZipCodeH AnchorSideTop.Control = edZipCodeH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edZipCodeH AnchorSideRight.Control = edZipCodeH
Left = 66 Left = 62
Height = 15 Height = 15
Top = 112 Top = 112
Width = 58 Width = 58
@ -728,7 +727,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = cbStateH AnchorSideTop.Control = cbStateH
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 108 Top = 108
Width = 120 Width = 120
@ -743,7 +742,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = cbCountryH AnchorSideTop.Control = cbCountryH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = cbCountryH AnchorSideRight.Control = cbCountryH
Left = 28 Left = 24
Height = 15 Height = 15
Top = 139 Top = 139
Width = 96 Width = 96
@ -763,10 +762,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edAddressH AnchorSideRight.Control = edAddressH
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 135 Top = 135
Width = 338 Width = 342
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
@ -781,7 +780,7 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Control = edCountryH AnchorSideTop.Control = edCountryH
AnchorSideTop.Side = asrCenter AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = edCountryH AnchorSideRight.Control = edCountryH
Left = 68 Left = 64
Height = 15 Height = 15
Top = 170 Top = 170
Width = 56 Width = 56
@ -800,10 +799,10 @@ object ContactEditForm: TContactEditForm
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = edAddressH AnchorSideRight.Control = edAddressH
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 132 Left = 128
Height = 23 Height = 23
Top = 166 Top = 166
Width = 338 Width = 342
Anchors = [akTop, akLeft, akRight] Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 4 BorderSpacing.Top = 4
BorderSpacing.Bottom = 8 BorderSpacing.Bottom = 8
@ -814,7 +813,7 @@ object ContactEditForm: TContactEditForm
end end
object tabContact: TTabSheet object tabContact: TTabSheet
Caption = 'tabContact' Caption = 'tabContact'
ClientHeight = 545 ClientHeight = 549
ClientWidth = 498 ClientWidth = 498
ImageIndex = 1 ImageIndex = 1
object gbPhone: TGroupBox object gbPhone: TGroupBox
@ -1233,7 +1232,7 @@ object ContactEditForm: TContactEditForm
end end
object tabCustom: TTabSheet object tabCustom: TTabSheet
Caption = 'tabCustom' Caption = 'tabCustom'
ClientHeight = 545 ClientHeight = 549
ClientWidth = 498 ClientWidth = 498
ImageIndex = 3 ImageIndex = 3
object lblCustom1: TLabel object lblCustom1: TLabel

View File

@ -166,6 +166,7 @@ type
ceContact: TVpContact; ceContact: TVpContact;
ceResource: TVpResource; ceResource: TVpResource;
public public
constructor Create(AOwner: TComponent); override;
function AddNewContact: Boolean; function AddNewContact: Boolean;
function Execute(Contact: TVpContact): Boolean; reintroduce; function Execute(Contact: TVpContact): Boolean; reintroduce;
published published
@ -256,7 +257,8 @@ end;
procedure TContactEditForm.OKBtnClick(Sender: TObject); procedure TContactEditForm.OKBtnClick(Sender: TObject);
begin begin
if (edLastName.Text = '') and (edFirstName.Text = '') then begin if (edLastName.Text = '') and (edFirstName.Text = '') then begin
raise EVpContactEditError.Create(RSNameIsRequired); MessageDlg(RSNameIsRequired, mtError, [mbOK], 0);
// raise EVpContactEditError.Create(RSNameIsRequired);
exit; exit;
end; end;
ReturnCode := rtCommit; ReturnCode := rtCommit;
@ -350,11 +352,12 @@ begin
edFirstName.Text := Contact.FirstName; edFirstName.Text := Contact.FirstName;
edTitle.Text := Contact.Title; edTitle.Text := Contact.Title;
if contact.Birthdate = 0.0 then if contact.Birthdate = 0.0 then
edBirthdate.Clear else edBirthdate.Clear
else
edBirthdate.Date := Contact.Birthdate; edBirthdate.Date := Contact.Birthdate;
cbCategory.Items.Clear; cbCategory.Items.Clear;
for ct := Low (TVpCategoryType) to High (TVpCategoryType) do for ct := Low(TVpCategoryType) to High(TVpCategoryType) do
cbCategory.Items.Add(CategoryLabel(ct)); cbCategory.Items.Add(CategoryLabel(ct));
cbCategory.ItemIndex := Contact.Category; cbCategory.ItemIndex := Contact.Category;
@ -505,19 +508,22 @@ var
Labels: TLabelArray; Labels: TLabelArray;
Comboboxes: TComboboxArray; Comboboxes: TComboboxArray;
largestLabelWidth: Integer; largestLabelWidth: Integer;
i: Integer; comboArrowWidth: Integer;
i, w: Integer;
OldFont: TFont; OldFont: TFont;
hlabeldist: Integer = 8; // min distance from label to edge of owner
hdist: Integer = 4; // Horizontal distance between label and edit/combo hdist: Integer = 4; // Horizontal distance between label and edit/combo
vDist: Integer = 4; // Vertical distance between edits vDist: Integer = 4; // Vertical distance between edits
hBorder: Integer = 8; // Horizontal distance between container border and label hBorder: Integer = 8; // Horizontal distance between container border and label
vBorder: Integer = 8; // Vertical distance between container border and 1st control vBorder: Integer = 8; // Vertical distance between container border and 1st control
comboArrowWidth: Integer; P: TPoint;
begin begin
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
{ Preparations } { Preparations }
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
hdist := ScaleX(hdist, DesignTimeDPI); hdist := ScaleX(hdist, DesignTimeDPI);
vdist := ScaleY(vdist, DesignTimeDPI); vdist := ScaleY(vdist, DesignTimeDPI);
hlabeldist := ScaleX(hlabeldist, DesignTimeDPI);
hBorder := ScaleX(hBorder, DesignTimeDPI); hBorder := ScaleX(hBorder, DesignTimeDPI);
vBorder := ScaleY(vBorder, DesignTimeDPI); vBorder := ScaleY(vBorder, DesignTimeDPI);
edBirthdate.ButtonWidth := edBirthdate.Height; edBirthdate.ButtonWidth := edBirthdate.Height;
@ -540,6 +546,17 @@ begin
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
{ Page "Base data" } { Page "Base data" }
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
SetLength(labels, 5);
labels[0] := lblLastName;
labels[1] := lblFirstName;
labels[2] := lblTitle;
labels[3] := lblCategory;
labels[4] := lblBirthdate;
largestLabelWidth := 0;
for i:=0 to High(labels) do
largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(labels[i]));
edLastName.Left := largestLabelWidth + hlabelDist;
edBirthdate.Width := edTitle.Width; edBirthdate.Width := edTitle.Width;
cbCategory.Width := edTitle.Width; cbCategory.Width := edTitle.Width;
{$IFDEF NEW_ICONS} {$IFDEF NEW_ICONS}
@ -583,6 +600,25 @@ begin
Comboboxes[i].Width := largestLabelWidth; Comboboxes[i].Width := largestLabelWidth;
end; end;
{----------------------------------------------------------------------------}
{ Page "Adresses" }
{----------------------------------------------------------------------------}
SetLength(labels, 8);
labels[0] := lblCompany;
labels[1] := lblDepartment;
labels[2] := lblPosition;
labels[3] := lblAddressW;
labels[4] := lblCityW;
labels[5] := lblZipCodeW;
labels[6] := lblStateW;
labels[7] := lblCountryW;
largestLabelWidth := 0;
for i:=0 to High(labels) do
largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(labels[i]));
edCompany.Left := largestlabelWidth + hlabeldist;
edAddressH.Left := edCompany.Left;
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
{ Page "User-defined" } { Page "User-defined" }
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
@ -596,12 +632,15 @@ begin
for i := Low(Labels) to High(Labels) do for i := Low(Labels) to High(Labels) do
largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(Labels[i])); largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(Labels[i]));
edCustom1.Left := hBorder + largestLabelWidth + hDist; edCustom1.Left := hBorder + largestLabelWidth + hLabelDist;
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
{ Form size } { Form size }
{----------------------------------------------------------------------------} {----------------------------------------------------------------------------}
Autosize := true; P := Point(0, gbHomeAddress.Height + gbHomeAddress.BorderSpacing.Bottom);
P := gbHomeAddress.ClientToScreen(P);
P := ScreenToClient(P);
Height := P.Y + pnlBottom.Height;
end; end;
procedure TContactEditForm.DisplayCurrentCountry(AddressType: TVpAddressType); procedure TContactEditForm.DisplayCurrentCountry(AddressType: TVpAddressType);
@ -781,6 +820,33 @@ end;
{ TVpContactEditDialog } { TVpContactEditDialog }
constructor TVpContactEditDialog.Create(AOwner: TComponent);
begin
inherited;
FOptions := FOptions + [doSizeable];
end;
function TVpContactEditDialog.AddNewContact: Boolean;
begin
result := false;
if DataStore <> nil then begin
if DataStore.Resource = nil then
Exit;
ceContact := DataStore.Resource.Contacts.AddContact(
DataStore.GetNextID(ContactsTableName));
if ceContact <> nil then begin
Result := Execute(ceContact);
if not Result then
(*
if Result then
DataStore.PostContacts
else
*)
ceContact.Free;
end;
end;
end;
function TVpContactEditDialog.Execute(Contact: TVpContact): Boolean; function TVpContactEditDialog.Execute(Contact: TVpContact): Boolean;
var var
EditForm: TContactEditForm; EditForm: TContactEditForm;
@ -812,27 +878,6 @@ begin
end; end;
end; end;
function TVpContactEditDialog.AddNewContact: Boolean;
begin
result := false;
if DataStore <> nil then begin
if DataStore.Resource = nil then
Exit;
ceContact := DataStore.Resource.Contacts.AddContact(
DataStore.GetNextID(ContactsTableName));
if ceContact <> nil then begin
Result := Execute(ceContact);
if not Result then
(*
if Result then
DataStore.PostContacts
else
*)
ceContact.Free;
end;
end;
end;
end. end.

View File

@ -241,13 +241,6 @@ var
baseTextHeight: Integer; baseTextHeight: Integer;
maxTextWidth: Integer; maxTextWidth: Integer;
begin begin
contactCount := FContactGrid.DataStore.Resource.Contacts.Count;
oldCol1RecCount := TVpContactGridOpener(FContactGrid).cgCol1RecCount;
TVpContactGridOpener(FContactGrid).FVisibleContacts := 0;
TVpContactGridOpener(FContactGrid).cgCol1RecCount := 0;
TextXOffset := 0;
TextYOffset := 0;
{ if the component is sufficiently small then no sense in painting it } { if the component is sufficiently small then no sense in painting it }
if (FContactGrid.Height < 20) then exit; if (FContactGrid.Height < 20) then exit;
@ -258,6 +251,14 @@ begin
then then
Exit; Exit;
{ Some initializations }
contactCount := FContactGrid.DataStore.Resource.Contacts.Count;
oldCol1RecCount := TVpContactGridOpener(FContactGrid).cgCol1RecCount;
TVpContactGridOpener(FContactGrid).FVisibleContacts := 0;
TVpContactGridOpener(FContactGrid).cgCol1RecCount := 0;
TextXOffset := 0;
TextYOffset := 0;
{ create a temporary bitmap for painting the items } { create a temporary bitmap for painting the items }
TmpBmp := TBitmap.Create; TmpBmp := TBitmap.Create;
try try

View File

@ -74,18 +74,17 @@ type
function GetVersion: String; function GetVersion: String;
procedure SetVersion(const Value: string); procedure SetVersion(const Value: string);
procedure SetControlLink (const v : TVpControlLink); procedure SetControlLink (const v: TVpControlLink);
procedure SetDataStore(Value: TVpCustomDataStore); procedure SetDataStore(Value: TVpCustomDataStore);
procedure DoFormPlacement(Form : TForm); procedure DoFormPlacement(Form: TForm);
procedure SetFormCaption(Form : TForm; const Title, SubTitle : string); procedure SetFormCaption(Form: TForm; const Title, SubTitle: string);
property Options : TVpDialogOptions read FOptions write FOptions; property Options: TVpDialogOptions read FOptions write FOptions;
property Placement : TVpDialogPlacement read FPlacement write FPlacement; property Placement: TVpDialogPlacement read FPlacement write FPlacement;
public public
constructor Create(AOwner : TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
function Execute : Boolean; virtual; function Execute: Boolean; virtual;
property ControlLink : TVpControlLink property ControlLink: TVpControlLink read FControlLink write SetControlLink;
read FControlLink write SetControlLink;
published published
property DataStore: TVpCustomDataStore read FDataStore write SetDataStore; property DataStore: TVpCustomDataStore read FDataStore write SetDataStore;
property Version: string read GetVersion write SetVersion; property Version: string read GetVersion write SetVersion;