diff --git a/components/tvplanit/source/vpcontacteditdlg.lfm b/components/tvplanit/source/vpcontacteditdlg.lfm index aec7bf9bf..9a6c76de6 100644 --- a/components/tvplanit/source/vpcontacteditdlg.lfm +++ b/components/tvplanit/source/vpcontacteditdlg.lfm @@ -29,111 +29,101 @@ object ContactEditForm: TContactEditForm ClientHeight = 351 ClientWidth = 425 object LastNameLbl: TLabel - Left = 8 - Height = 16 + Left = 9 + Height = 15 Top = 6 - Width = 127 + Width = 54 Alignment = taRightJustify - AutoSize = False Caption = 'Last name' FocusControl = LastNameEdit ParentColor = False end object AddrLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 81 - Width = 127 + Width = 42 Alignment = taRightJustify - AutoSize = False Caption = 'Address' FocusControl = AddressEdit ParentColor = False end object CityLbl: TLabel Left = 8 - Height = 16 - Top = 105 - Width = 127 + Height = 15 + Top = 104 + Width = 21 Alignment = taRightJustify - AutoSize = False Caption = 'City' FocusControl = CityEdit ParentColor = False end object StateLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 129 - Width = 127 + Width = 26 Alignment = taRightJustify - AutoSize = False Caption = 'State' FocusControl = cboxState ParentColor = False end object ZipLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 153 - Width = 127 + Width = 48 Alignment = taRightJustify - AutoSize = False Caption = 'Zip Code' FocusControl = ZipCodeEdit ParentColor = False end object CountryLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 177 - Width = 127 + Width = 43 Alignment = taRightJustify - AutoSize = False Caption = 'Country' FocusControl = cboxCountry ParentColor = False end object PositionLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 226 - Width = 127 + Width = 43 Alignment = taRightJustify - AutoSize = False Caption = 'Position' FocusControl = PositionEdit ParentColor = False end object TitleLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 58 - Width = 127 + Width = 23 Alignment = taRightJustify - AutoSize = False Caption = 'Title' FocusControl = TitleEdit ParentColor = False end object CompanyLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 202 - Width = 127 + Width = 52 Alignment = taRightJustify - AutoSize = False Caption = 'Company' FocusControl = CompanyEdit ParentColor = False end object CategoryLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 253 - Width = 127 + Width = 48 Alignment = taRightJustify - AutoSize = False Caption = 'Category' FocusControl = cboxCategory ParentColor = False @@ -257,11 +247,10 @@ object ContactEditForm: TContactEditForm end object FirstNameLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 31 - Width = 127 + Width = 55 Alignment = taRightJustify - AutoSize = False Caption = 'First name' FocusControl = FirstNameEdit ParentColor = False @@ -283,11 +272,10 @@ object ContactEditForm: TContactEditForm end object BirthdateLbl: TLabel Left = 8 - Height = 16 + Height = 15 Top = 284 - Width = 127 + Width = 51 Alignment = taRightJustify - AutoSize = False Caption = 'Birth date' FocusControl = BirthdateEdit ParentColor = False diff --git a/components/tvplanit/source/vpcontacteditdlg.pas b/components/tvplanit/source/vpcontacteditdlg.pas index 79dd27753..bcbbfcccc 100644 --- a/components/tvplanit/source/vpcontacteditdlg.pas +++ b/components/tvplanit/source/vpcontacteditdlg.pas @@ -368,13 +368,15 @@ end; procedure TContactEditForm.ResizeControls; const ComboArrowWidth = 32; - FieldVertSep = 25; +// FieldVertSep = 25; // FormRightBorder = 20; // MinFormWidth = 265; // FormHeightOffset = 103; // MinFormHeight = 250; TopField = 8; DIST = 4; // distance between label and edit/combo + HBORDER = 8; // distance between container border and label + VDIST = 2; // vertical distance between edits type TLabelArray = array of TLabel; @@ -385,14 +387,14 @@ var Labels: TLabelArray; Comboboxes: TComboboxArray; Edits: TEditArray; - LargestLabel: Integer; + LargestLabelWidth: Integer; WidestField: Integer; i, j: Integer; OldFont: TFont; FieldTop: Integer; delta: Integer; - horMargin: Integer; // Margin at left and right from tabsheet to label/edit corr: Integer; // difference between form's client width and tabsheet width + editHeight: Integer; // Height of an edit control begin { Note: The resizing algorithm is dependent upon the labels having their @@ -412,17 +414,17 @@ begin Labels[10] := CategoryLbl; Labels[11] := BirthdateLbl; - LargestLabel := 0; + LargestLabelWidth := 0; for i := Low(Labels) to High(Labels) do - LargestLabel := Max(LargestLabel, GetLabelWidth(Labels[i])); + LargestLabelWidth := Max(LargestLabelWidth, GetLabelWidth(Labels[i])); { Determine width of label based upon whether large or small fonts are in effect. } for i := Low(Labels) to High(Labels) do begin - Labels[i].Width := LargestLabel; - Labels[i].FocusControl.Left := LastNameLbl.Left + LargestLabel + DIST; + Labels[i].FocusControl.Left := HBORDER + LargestLabelWidth + DIST; + Labels[i].Left := Labels[i].FocusControl.Left - DIST - GetLabelWidth(Labels[i]); + Labels[i].Top := Labels[i].FocusControl.Top + (Labels[i].FocusControl.Height - Labels[i].Height) div 2; end; - horMargin := Labels[0].Left; widestField := 250; @@ -452,7 +454,7 @@ begin { Set form width according to widest field } corr := ClientWidth - tabMain.ClientWidth; - ClientWidth := LastNameEdit.Left + widestfield + horMargin + corr; + ClientWidth := LastNameEdit.Left + widestfield + HBORDER + corr; { Set edit and combo widths } for i:= Low(Labels) to High(Labels) do @@ -464,13 +466,15 @@ begin cboxState.Width := widestField; { Vertically arrange the fields. } + editHeight := LastNameEdit.Height; + delta := (Labels[0].FocusControl.Height - labels[0].Height) div 2; FieldTop := TopField; for i := Low(Labels) to High(Labels) do if Labels[i].Visible then begin Labels[i].FocusControl.Top := FieldTop; Labels[i].Top := FieldTop + delta; - inc(FieldTop, FieldVertSep); + inc(FieldTop, editHeight + VDIST); end; { Set form height such that first tab is filled completely by controls } @@ -492,13 +496,13 @@ begin Edits[3] := Phone4Edit; Edits[4] := Phone5Edit; - largestLabel := GetLabelWidth(EMailLbl); + largestLabelWidth := GetLabelWidth(EMailLbl); OldFont := TFont.Create; try OldFont.Assign(Canvas.Font); Canvas.Font.Assign(cboxPhoneLbl1.Font); for i:=0 to cboxPhoneLbl1.Items.Count-1 do - largestLabel := Max(cboxPhoneLbl1.Canvas.TextWidth(cboxPhoneLbl1.Items[i]) + ComboArrowWidth, largestlabel); + largestLabelWidth := Max(cboxPhoneLbl1.Canvas.TextWidth(cboxPhoneLbl1.Items[i]) + ComboArrowWidth, largestlabelWidth); finally Canvas.Font.Assign(OldFont); OldFont.Free; @@ -506,25 +510,24 @@ begin FieldTop := TopField; for i:=Low(Comboboxes) to High(Comboboxes) do begin - Comboboxes[i].Left := horMargin; - Comboboxes[i].Width := largestLabel; + Comboboxes[i].Left := HBORDER; + Comboboxes[i].Width := largestLabelWidth; Comboboxes[i].Top := FieldTop; - inc(FieldTop, FieldVertSep); + inc(FieldTop, editHeight + VDIST); end; for i:= Low(Edits) to High(Edits) do begin Edits[i].Left := cboxPhoneLbl1.Left + cboxPhoneLbl1.Width + DIST; - Edits[i].Width := ClientWidth - Edits[i].Left - horMargin - corr; + Edits[i].Width := ClientWidth - Edits[i].Left - HBORDER - corr; Edits[i].Top := Comboboxes[i].Top; end; EMailEdit.Left := Phone1Edit.Left; EMailEdit.Width := Phone1Edit.Width; - EMailEdit.Top := Phone5Edit.Top + FieldVertSep; + EMailEdit.Top := Phone5Edit.Top + editHeight + VDIST; EMailLbl.Left := EMailEdit.Left - GetLabelWidth(EMailLbl) - DIST; EMailLbl.Top := EMailEdit.Top + delta; - { Page "User-defined" } SetLength(Labels, 4); Labels[0] := CustomLbl1; @@ -532,19 +535,19 @@ begin Labels[2] := CustomLbl3; Labels[3] := CustomLbl4; - largestLabel := 0; + largestLabelWidth := 0; for i := Low(Labels) to High(Labels) do - largestLabel := Max(largestLabel, GetLabelWidth(Labels[i])); + largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(Labels[i])); FieldTop := TopField; for i := Low(Labels) to High(Labels) do begin - Labels[i].FocusControl.Left := horMargin + LargestLabel + DIST; + Labels[i].FocusControl.Left := HBORDER + LargestLabelWidth + DIST; Labels[i].FocusControl.Top := FieldTop; - Labels[i].FocusControl.Width := ClientWidth - Labels[i].FocusControl.Left - horMargin - corr; - Labels[i].Width := LargestLabel; + Labels[i].FocusControl.Width := ClientWidth - Labels[i].FocusControl.Left - HBORDER - corr; + Labels[i].Width := LargestLabelWidth; Labels[i].Left := Labels[i].FocusControl.Left - GetLabelWidth(Labels[i]) - DIST; Labels[i].Top := FieldTop + delta; - inc(FieldTop, FieldVertSep); + inc(FieldTop, editHeight + VDIST); end; end;