tvplanit: Update ResourceEditForm to scale correctly in the HighDpi mode of Lazarus 1.8. Fix scaling of button panel in contacts and event editor forms.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5876 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
21df6e63ed
commit
748cdf1c53
@ -1392,22 +1392,25 @@ object ContactEditForm: TContactEditForm
|
||||
ClientWidth = 506
|
||||
TabOrder = 1
|
||||
object OKBtn: TButton
|
||||
AnchorSideTop.Control = CancelBtn
|
||||
AnchorSideTop.Control = pnlBottom
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = CancelBtn
|
||||
AnchorSideBottom.Control = CancelBtn
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 354
|
||||
Height = 25
|
||||
Top = 4
|
||||
Width = 74
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
OnClick = OKBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
AnchorSideTop.Control = pnlBottom
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = pnlBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
|
@ -150,7 +150,7 @@ type
|
||||
FBtnHeight: Integer;
|
||||
FEditHeight: Integer;
|
||||
procedure DisplayCurrentCountry(AddressType: TVpAddressType);
|
||||
procedure ResizeControls;
|
||||
procedure PositionControls;
|
||||
procedure SetCaptions;
|
||||
public
|
||||
Resource: TVpResource;
|
||||
@ -468,7 +468,6 @@ begin
|
||||
|
||||
DisplayCurrentCountry(atWork);
|
||||
DisplayCurrentCountry(atHome);
|
||||
ResizeControls;
|
||||
end;
|
||||
|
||||
procedure TContactEditForm.ItemChanged(Sender: TObject);
|
||||
@ -502,7 +501,7 @@ begin
|
||||
PageControl.ActivePage := tabBaseData;
|
||||
end;
|
||||
|
||||
procedure TContactEditForm.ResizeControls;
|
||||
procedure TContactEditForm.PositionControls;
|
||||
type
|
||||
TLabelArray = array of TLabel;
|
||||
TComboboxArray = array of TCombobox;
|
||||
@ -510,7 +509,6 @@ type
|
||||
var
|
||||
Labels: TLabelArray;
|
||||
Comboboxes: TComboboxArray;
|
||||
Edits: TEditArray;
|
||||
largestLabelWidth: Integer;
|
||||
i: Integer;
|
||||
OldFont: TFont;
|
||||
@ -518,7 +516,6 @@ var
|
||||
vDist: Integer = 4; // Vertical distance between edits
|
||||
hBorder: Integer = 8; // Horizontal distance between container border and label
|
||||
vBorder: Integer = 8; // Vertical distance between container border and 1st control
|
||||
w,h: Integer;
|
||||
comboArrowWidth: Integer;
|
||||
begin
|
||||
{----------------------------------------------------------------------------}
|
||||
@ -734,8 +731,6 @@ begin
|
||||
stateComboLabel.Hide;
|
||||
stateCombo.Items.Clear;
|
||||
end;
|
||||
|
||||
// ResizeControls;
|
||||
end;
|
||||
|
||||
procedure TContactEditForm.cbCountryChange(Sender: TObject);
|
||||
@ -749,7 +744,7 @@ begin
|
||||
cbStateH.Text := '';
|
||||
DisplayCurrentCountry(atHome);
|
||||
end;
|
||||
ResizeControls;
|
||||
PositionControls;
|
||||
end;
|
||||
|
||||
procedure TContactEditForm.FormKeyDown(Sender: TObject; var Key: Word;
|
||||
@ -782,6 +777,7 @@ begin
|
||||
PageControl.ActivePage := tabBaseData;
|
||||
if PageControl.ActivePage = tabBaseData then
|
||||
edLastName.SetFocus;
|
||||
PositionControls;
|
||||
end;
|
||||
|
||||
|
||||
|
@ -2,33 +2,40 @@ object ResEditForm: TResEditForm
|
||||
Left = 280
|
||||
Height = 302
|
||||
Top = 234
|
||||
Width = 455
|
||||
Width = 466
|
||||
HorzScrollBar.Page = 399
|
||||
VertScrollBar.Page = 249
|
||||
Caption = 'Resource Edit'
|
||||
ClientHeight = 302
|
||||
ClientWidth = 455
|
||||
ClientWidth = 466
|
||||
Constraints.MinHeight = 250
|
||||
Constraints.MinWidth = 400
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
LCLVersion = '1.7'
|
||||
LCLVersion = '1.9.0.0'
|
||||
object pnlBottom: TPanel
|
||||
Left = 0
|
||||
Height = 41
|
||||
Top = 261
|
||||
Width = 455
|
||||
Height = 33
|
||||
Top = 269
|
||||
Width = 466
|
||||
Align = alBottom
|
||||
AutoSize = True
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 41
|
||||
ClientWidth = 455
|
||||
ClientHeight = 33
|
||||
ClientWidth = 466
|
||||
TabOrder = 1
|
||||
object OKBtn: TButton
|
||||
Left = 291
|
||||
AnchorSideTop.Control = pnlBottom
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = CancelBtn
|
||||
Left = 313
|
||||
Height = 25
|
||||
Top = 7
|
||||
Width = 75
|
||||
Anchors = [akRight, akBottom]
|
||||
Top = 4
|
||||
Width = 66
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
OnClick = OKBtnClick
|
||||
@ -36,11 +43,18 @@ object ResEditForm: TResEditForm
|
||||
TabStop = False
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
Left = 370
|
||||
AnchorSideTop.Control = pnlBottom
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = pnlBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 383
|
||||
Height = 25
|
||||
Top = 7
|
||||
Top = 4
|
||||
Width = 75
|
||||
Anchors = [akRight, akBottom]
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
OnClick = CancelBtnClick
|
||||
@ -50,9 +64,9 @@ object ResEditForm: TResEditForm
|
||||
end
|
||||
object pgResource: TPageControl
|
||||
Left = 0
|
||||
Height = 261
|
||||
Height = 269
|
||||
Top = 0
|
||||
Width = 455
|
||||
Width = 466
|
||||
TabStop = False
|
||||
ActivePage = tabResource
|
||||
Align = alClient
|
||||
@ -60,31 +74,44 @@ object ResEditForm: TResEditForm
|
||||
TabOrder = 0
|
||||
object tabResource: TTabSheet
|
||||
Caption = 'Resource'
|
||||
ClientHeight = 233
|
||||
ClientWidth = 447
|
||||
ClientHeight = 241
|
||||
ClientWidth = 458
|
||||
object lblDescription: TLabel
|
||||
AnchorSideLeft.Control = tabResource
|
||||
AnchorSideTop.Control = DescriptionEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 24
|
||||
Top = 20
|
||||
Width = 63
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Description:'
|
||||
ParentColor = False
|
||||
end
|
||||
object lblNotes: TLabel
|
||||
AnchorSideLeft.Control = lblDescription
|
||||
AnchorSideTop.Control = DescriptionEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 47
|
||||
Width = 34
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Notes:'
|
||||
ParentColor = False
|
||||
end
|
||||
object imgResources: TImage
|
||||
Left = 405
|
||||
AnchorSideTop.Control = DescriptionEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = tabResource
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 416
|
||||
Height = 32
|
||||
Top = 15
|
||||
Top = 11
|
||||
Width = 32
|
||||
Anchors = [akTop]
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 10
|
||||
Picture.Data = {
|
||||
07544269746D617076020000424D760200000000000076000000280000002000
|
||||
0000200000000100040000000000000200000000000000000000100000001000
|
||||
@ -111,21 +138,37 @@ object ResEditForm: TResEditForm
|
||||
Transparent = True
|
||||
end
|
||||
object DescriptionEdit: TEdit
|
||||
Left = 80
|
||||
AnchorSideLeft.Control = lblDescription
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = tabResource
|
||||
Left = 83
|
||||
Height = 23
|
||||
Top = 20
|
||||
Width = 318
|
||||
Top = 16
|
||||
Width = 326
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 16
|
||||
MaxLength = 255
|
||||
OnChange = Change
|
||||
TabOrder = 0
|
||||
end
|
||||
object NotesMemo: TMemo
|
||||
AnchorSideLeft.Control = tabResource
|
||||
AnchorSideTop.Control = lblNotes
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = tabResource
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = tabResource
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 154
|
||||
Top = 67
|
||||
Width = 429
|
||||
Height = 167
|
||||
Top = 66
|
||||
Width = 442
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
MaxLength = 1024
|
||||
OnChange = Change
|
||||
ScrollBars = ssVertical
|
||||
|
@ -58,11 +58,11 @@ type
|
||||
lblNotes: TLabel;
|
||||
NotesMemo: TMemo;
|
||||
imgResources: TImage;
|
||||
procedure OKBtnClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure CancelBtnClick(Sender: TObject);
|
||||
procedure Change(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure OKBtnClick(Sender: TObject);
|
||||
private
|
||||
procedure PositionControls;
|
||||
procedure SetControls;
|
||||
@ -209,48 +209,12 @@ begin
|
||||
lblNotes.Caption := RSNotes;
|
||||
OKBtn.Caption := RSOKBtn;
|
||||
CancelBtn.Caption := RSCancelBtn;
|
||||
|
||||
PositionControls;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TResEditForm.PositionControls;
|
||||
var
|
||||
HDelta: Integer = 8;
|
||||
VDelta: Integer = 8;
|
||||
begin
|
||||
HDelta := ScaleX(HDelta, DesignTimeDPI);
|
||||
VDelta := ScaleY(VDelta, DesignTimeDPI);
|
||||
|
||||
DescriptionEdit.Left := lblDescription.Left + GetLabelWidth(lblDescription) + HDelta;
|
||||
DescriptionEdit.Width := imgResources.Left - 2*HDelta - DescriptionEdit.Left;
|
||||
DescriptionEdit.Top := imgResources.Top; // + (imgResources.Height - DescriptionEdit.Height) div 2;
|
||||
lblDescription.Top := DescriptionEdit.Top + (DescriptionEdit.Height - lblDescription.Height) div 2;
|
||||
|
||||
lblNotes.Top := BottomOf(DescriptionEdit) + VDelta;
|
||||
NotesMemo.Top := BottomOf(lblNotes) + VDelta;
|
||||
ClientHeight := ClientHeight + ScaleY(NotesMemo.Height, DesignTimeDPI) - NotesMemo.Height;
|
||||
NotesMemo.Height := tabResource.ClientHeight - NotesMemo.Top - VDelta;
|
||||
|
||||
OKBtn.Height := ScaleY(OKBtn.Height, DesignTimeDPI);
|
||||
CancelBtn.Height := OKBtn.Height;
|
||||
pnlBottom.Height := VDelta + OKBtn.Height + VDelta;
|
||||
OKBtn.Top := VDelta;
|
||||
CancelBtn.Top := VDelta;
|
||||
|
||||
OKBtn.Width := Max(GetButtonWidth(OKBtn), GetButtonWidth(CancelBtn));
|
||||
CancelBtn.Width := OKBtn.Width;
|
||||
{$IFDEF MSWINDOWS}
|
||||
CancelBtn.Left := pnlBottom.ClientWidth - lblDescription.Left - CancelBtn.Width;
|
||||
OKBtn.Left := CancelBtn.Left - OKBtn.Width - HDelta; // - (ClientWidth - tabResource.ClientWidth);
|
||||
OKBtn.TabOrder := 0;
|
||||
CancelBtn.TabOrder := 1;
|
||||
{$ELSE}
|
||||
OKBtn.Left := pnlBottom.ClientWidth - lblDescription.Left - OKBtn.Width;
|
||||
CancelBtn.Left := OKBtn.Left - CancelBtn.Width - HDelta; // - (ClientWidth - tabResource.ClientWidth);
|
||||
CancelBtn.TabOrder := 0;
|
||||
OKBtn.TabOrder := 1;
|
||||
{$ENDIF}
|
||||
AlignOKCancel(OKBtn, CancelBtn, pnlBottom);
|
||||
end;
|
||||
|
||||
procedure TResEditForm.OKBtnClick(Sender: TObject);
|
||||
@ -287,6 +251,7 @@ procedure TResEditForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
DescriptionEdit.SetFocus;
|
||||
SetControls;
|
||||
PositionControls;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
@ -28,35 +28,37 @@ object TaskEditForm: TTaskEditForm
|
||||
AnchorSideTop.Control = ButtonPanel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 4
|
||||
Height = 17
|
||||
Top = 8
|
||||
Width = 108
|
||||
Height = 15
|
||||
Top = 9
|
||||
Width = 88
|
||||
BorderSpacing.Left = 4
|
||||
Caption = 'Resource Name'
|
||||
Font.CharSet = ANSI_CHARSET
|
||||
Font.Color = clMaroon
|
||||
Font.Height = -14
|
||||
Font.Name = 'Tahoma'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object OKBtn: TButton
|
||||
AnchorSideTop.Control = CancelBtn
|
||||
AnchorSideBottom.Control = CancelBtn
|
||||
AnchorSideTop.Control = ButtonPanel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 376
|
||||
Height = 25
|
||||
Top = 4
|
||||
Width = 86
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
OnClick = OKBtnClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object CancelBtn: TButton
|
||||
AnchorSideTop.Control = ButtonPanel
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 479
|
||||
Height = 25
|
||||
|
@ -180,8 +180,6 @@ begin
|
||||
LblCreatedOn.Caption := RSCreatedOn + ' ' + FormatDateTime('ddddd', Task.CreatedOn);
|
||||
CbPriority.ItemIndex := Task.Priority + 1;
|
||||
CbCategory.ItemIndex := Task.Category;
|
||||
|
||||
PositionControls;
|
||||
end;
|
||||
|
||||
procedure TTaskEditForm.PositionControls;
|
||||
@ -281,6 +279,7 @@ end;
|
||||
|
||||
procedure TTaskEditForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
PositionControls;
|
||||
DescriptionEdit.SetFocus;
|
||||
end;
|
||||
{=====}
|
||||
|
Loading…
Reference in New Issue
Block a user