You've already forked lazarus-ccr
tvplanit: Remove unnecessary routines. Improved HiDPI performance of TaskEdit dlg, Alarm dlg, and ExVpRptSetup (used by fulldemo).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5888 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -2,93 +2,145 @@ object frmReportSetup: TfrmReportSetup
|
||||
Left = 380
|
||||
Height = 138
|
||||
Top = 138
|
||||
Width = 291
|
||||
Width = 299
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Report Setup'
|
||||
ClientHeight = 138
|
||||
ClientWidth = 291
|
||||
ClientWidth = 299
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poMainFormCenter
|
||||
LCLVersion = '1.7'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object lblStartDate: TLabel
|
||||
Left = 16
|
||||
AnchorSideTop.Control = edStartDate
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = edStartDate
|
||||
Left = 42
|
||||
Height = 15
|
||||
Top = 16
|
||||
Top = 12
|
||||
Width = 54
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Start Date:'
|
||||
FocusControl = edStartDate
|
||||
ParentColor = False
|
||||
end
|
||||
object lblEndDate: TLabel
|
||||
Left = 20
|
||||
AnchorSideTop.Control = edEndDate
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = edEndDate
|
||||
Left = 46
|
||||
Height = 15
|
||||
Top = 40
|
||||
Top = 43
|
||||
Width = 50
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'End Date:'
|
||||
FocusControl = edEndDate
|
||||
ParentColor = False
|
||||
end
|
||||
object lblFormat: TLabel
|
||||
Left = 29
|
||||
AnchorSideTop.Control = PrintFormatCombo
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = PrintFormatCombo
|
||||
Left = 55
|
||||
Height = 15
|
||||
Top = 75
|
||||
Top = 74
|
||||
Width = 41
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Format:'
|
||||
FocusControl = VpPrintFormatComboBox1
|
||||
FocusControl = PrintFormatCombo
|
||||
ParentColor = False
|
||||
end
|
||||
object btnOK: TButton
|
||||
Left = 128
|
||||
AnchorSideTop.Control = PrintFormatCombo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = btnCancel
|
||||
Left = 125
|
||||
Height = 25
|
||||
Top = 104
|
||||
Top = 105
|
||||
Width = 75
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 3
|
||||
end
|
||||
object btnCancel: TButton
|
||||
AnchorSideTop.Control = PrintFormatCombo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 208
|
||||
Height = 25
|
||||
Top = 104
|
||||
Width = 75
|
||||
Top = 105
|
||||
Width = 83
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 4
|
||||
end
|
||||
object VpPrintFormatComboBox1: TVpPrintFormatComboBox
|
||||
Left = 76
|
||||
object PrintFormatCombo: TVpPrintFormatComboBox
|
||||
AnchorSideLeft.Control = edStartDate
|
||||
AnchorSideTop.Control = edEndDate
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edStartDate
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 104
|
||||
Height = 23
|
||||
Top = 72
|
||||
Width = 207
|
||||
Top = 70
|
||||
Width = 187
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
Borderspacing.Top = 8
|
||||
Borderspacing.Bottom = 12
|
||||
ItemHeight = 15
|
||||
Sorted = True
|
||||
TabOrder = 2
|
||||
end
|
||||
object edStartDate: TDateEdit
|
||||
Left = 76
|
||||
AnchorSideTop.Control = Owner
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 104
|
||||
Height = 23
|
||||
Top = 12
|
||||
Width = 207
|
||||
Top = 8
|
||||
Width = 187
|
||||
CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
|
||||
DateOrder = doNone
|
||||
ButtonWidth = 23
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
NumGlyphs = 1
|
||||
MaxLength = 0
|
||||
TabOrder = 0
|
||||
end
|
||||
object edEndDate: TDateEdit
|
||||
Left = 76
|
||||
AnchorSideLeft.Control = edStartDate
|
||||
AnchorSideTop.Control = edStartDate
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = edStartDate
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 104
|
||||
Height = 23
|
||||
Top = 36
|
||||
Width = 207
|
||||
Top = 39
|
||||
Width = 187
|
||||
CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
|
||||
DateOrder = doNone
|
||||
ButtonWidth = 23
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 8
|
||||
NumGlyphs = 1
|
||||
MaxLength = 0
|
||||
TabOrder = 1
|
||||
|
@ -48,7 +48,7 @@ type
|
||||
lblFormat: TLabel;
|
||||
edStartDate: TDateEdit;
|
||||
edEndDate: TDateEdit;
|
||||
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
|
||||
PrintFormatCombo: TVpPrintFormatComboBox;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
@ -79,7 +79,8 @@ implementation
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math, VpSR, VpMisc;
|
||||
Math, LCLIntf, LCLType,
|
||||
VpSR, VpMisc;
|
||||
|
||||
{ TfrmReportSetup }
|
||||
|
||||
@ -87,7 +88,7 @@ function TfrmReportSetup.Execute(var ReportData: TReportDataRec) : Boolean;
|
||||
begin
|
||||
StartDate := ReportData.StartDate;
|
||||
EndDate := ReportData.EndDate;
|
||||
VpPrintFormatCombobox1.ItemIndex := ControlLink.Printer.Find(ReportData.Format);
|
||||
PrintFormatCombo.ItemIndex := ControlLink.Printer.Find(ReportData.Format);
|
||||
|
||||
Result := ShowModal = mrOk;
|
||||
|
||||
@ -107,7 +108,7 @@ end;
|
||||
|
||||
function TfrmReportSetup.GetControlLink: TVpControlLink;
|
||||
begin
|
||||
Result := VpPrintFormatComboBox1.ControlLink;
|
||||
Result := PrintFormatCombo.ControlLink;
|
||||
end;
|
||||
|
||||
function TfrmReportSetup.GetDate(Index: Integer) : TDateTime;
|
||||
@ -121,59 +122,56 @@ end;
|
||||
|
||||
procedure TfrmReportSetup.PositionControls;
|
||||
var
|
||||
w: Integer;
|
||||
delta: Integer = 8;
|
||||
vdist: Integer = 4;
|
||||
editHeight: Integer;
|
||||
buttonHeight: Integer;
|
||||
i, w, h: Integer;
|
||||
cnv: TControlCanvas;
|
||||
begin
|
||||
delta := ScaleX(8, DesignTimeDPI);
|
||||
vdist := ScaleY(4, DesignTimeDPI);
|
||||
buttonHeight := ScaleY(btnOK.Height, DesignTimeDPI);
|
||||
AutoSize := false;
|
||||
|
||||
with TEdit.Create(nil) do
|
||||
try
|
||||
Parent := self;
|
||||
editHeight := Height;
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
btnOK.AutoSize := true;
|
||||
btnCancel.AutoSize := true;
|
||||
w := Max(btnOK.Width, btnCancel.Width);
|
||||
h := btnOK.Height;
|
||||
|
||||
// horizontal
|
||||
w := Maxvalue([GetLabelWidth(lblStartDate), GetLabelWidth(lblEndDate), GetLabelWidth(lblFormat)]);
|
||||
edStartDate.Left := delta + w + delta;
|
||||
lblStartDate.Left := edStartDate.Left - delta - GetLabelWidth(lblStartDate);
|
||||
edEndDate.Left := edStartDate.Left;
|
||||
lblEndDate.Left := edEndDate.Left - delta - GetLabelWidth(lblEndDate);
|
||||
VpPrintFormatCombobox1.Left := edStartDate.Left;
|
||||
lblFormat.Left := VpPrintFormatCombobox1.Left - delta - GetLabelWidth(lblFormat);
|
||||
|
||||
ClientWidth := RightOf(edStartDate) + delta;
|
||||
w := Max(GetButtonWidth(btnOK), GetButtonWidth(btnCancel));
|
||||
btnOK.AutoSize := false;
|
||||
btnOK.Width := w;
|
||||
btnOK.Height := h;
|
||||
|
||||
btnCancel.AutoSize := false;
|
||||
btnCancel.Width := w;
|
||||
btnCancel.Left := ClientWidth - delta - w;
|
||||
btnOK.Left := btnCancel.Left - delta - w;
|
||||
btnCancel.Height := h;
|
||||
|
||||
// vertical
|
||||
edStartdate.Height := editHeight;
|
||||
edEndDate.Height := editHeight;
|
||||
edStartDate.ButtonWidth := editHeight;
|
||||
edEndDate.ButtonWidth := editHeight;
|
||||
{$IFDEF MSWINDOWS} // button order: OK - Cancel
|
||||
btnCancel.AnchorSideRight.Control := self;
|
||||
btnCancel.Anchors := [akTop, akRight];
|
||||
btnOK.AnchorSideRight.Control := btnCancel;
|
||||
btnOK.Anchors := [akTop, akRight];
|
||||
btnOK.TabOrder := PrintFormatCombo.TabOrder;
|
||||
btnCancel.TabOrder := PrintFormatCombo.TabOrder + 1;
|
||||
{$ELSE} // button order: Cancel - OK
|
||||
btnOK.AnchorSideRight.Control := self;
|
||||
btnOK.Anchors := [akTop, akRight];
|
||||
btnCancel.AnchorSideRight.Control := btnOK;
|
||||
btnCancel.Anchors := [akTop, akRight];
|
||||
btnCancel.TabOrder := PrintFormatCombo.TabOrder;
|
||||
btnOK.TabOrder := PrintFormatCombo.TabOrder + 1;
|
||||
{$ENDIF}
|
||||
|
||||
edEndDate.Top := BottomOf(edStartDate) + vdist;
|
||||
lblStartDate.Top := edStartDate.Top + (edStartDate.Height - lblStartDate.Height) div 2;
|
||||
lblEndDate.Top := edEndDate.Top + (edEndDate.Height - lblEndDate.Height) div 2;
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := PrintFormatCombo;
|
||||
w := 0;
|
||||
for i:=0 to PrintFormatCombo.Items.Count-1 do
|
||||
w := Max(w, cnv.TextWidth(PrintFormatCombo.Items[i]));
|
||||
inc(w, GetSystemMetrics(SM_CXVSCROLL));
|
||||
edStartDate.Width := w;
|
||||
// The width of the PrintFormatCombo is anchored to the edStartDate!
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
|
||||
VpPrintFormatCombobox1.Top := Bottomof(edEndDate) + 2*vdist;
|
||||
lblFormat.Top := VpPrintFormatCombobox1.Top + (VpPrintFormatCombobox1.Height - lblFormat.Height) div 2;
|
||||
|
||||
btnOK.Top := BottomOf(VpPrintFormatCombobox1) + 2*vdist;
|
||||
btnCancel.Top := btnOK.Top;
|
||||
btnOK.Height := buttonHeight;
|
||||
btnCancel.Height := buttonHeight;
|
||||
|
||||
ClientHeight := BottomOf(btnOK) + delta;
|
||||
edStartDate.ButtonWidth := edStartDate.Height;
|
||||
edEndDate.ButtonWidth := edEndDate.Height;
|
||||
AutoSize := true;
|
||||
end;
|
||||
|
||||
procedure TfrmReportSetup.SaveData(out ReportData: TReportDataRec);
|
||||
@ -194,7 +192,7 @@ begin
|
||||
ReportData.StartDate := edStartDate.Date;
|
||||
ReportData.EndDate := edEndDate.Date;
|
||||
end;
|
||||
ReportData.Format := VpPrintFormatComboBox1.Text;
|
||||
ReportData.Format := PrintFormatCombo.Text;
|
||||
end;
|
||||
|
||||
procedure TfrmReportSetup.SetCaptions;
|
||||
@ -209,7 +207,7 @@ end;
|
||||
|
||||
procedure TfrmReportSetup.SetControlLink(const Value: TVpControlLink);
|
||||
begin
|
||||
VpPrintFormatComboBox1.ControlLink := Value;
|
||||
PrintFormatCombo.ControlLink := Value;
|
||||
end;
|
||||
|
||||
procedure TfrmReportSetup.SetDate(Index: Integer;
|
||||
|
@ -58,7 +58,7 @@ object MainForm: TMainForm
|
||||
Height = 528
|
||||
Top = 48
|
||||
Width = 834
|
||||
PageIndex = 3
|
||||
PageIndex = 0
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
|
@ -16,7 +16,7 @@ object AlarmNotifyForm: TAlarmNotifyForm
|
||||
OnKeyDown = FormKeyDown
|
||||
OnShow = FormShow
|
||||
Position = poDefault
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object SnoozeCaption: TLabel
|
||||
AnchorSideLeft.Control = lTime
|
||||
AnchorSideTop.Control = Bevel1
|
||||
|
@ -69,8 +69,9 @@ type
|
||||
private
|
||||
SnoozeDelay: TDateTime;
|
||||
ShowTime : TDateTime;
|
||||
|
||||
procedure CalcSnooze;
|
||||
protected
|
||||
procedure PositionControls;
|
||||
public
|
||||
Event: TVpEvent;
|
||||
DataStore: TVpCustomDataStore;
|
||||
@ -299,6 +300,11 @@ end;
|
||||
{=====}
|
||||
|
||||
procedure TAlarmNotifyForm.FormShow(Sender: TObject);
|
||||
begin
|
||||
PositionControls;
|
||||
end;
|
||||
|
||||
procedure TAlarmNotifyForm.PositionControls;
|
||||
var
|
||||
w, h: Integer;
|
||||
b: TButton;
|
||||
@ -317,21 +323,22 @@ begin
|
||||
cnv.Free;
|
||||
end;
|
||||
|
||||
b := SnoozeBtn;
|
||||
if GetButtonWidth(b) > w then
|
||||
w := GetButtonWidth(b);
|
||||
if GetButtonWidth(OpenItemBtn) > w then begin
|
||||
b := OpenItemBtn;
|
||||
w := GetButtonWidth(b);
|
||||
end;
|
||||
if GetButtonWidth(DismissBtn) > w then begin
|
||||
b := DismissBtn;
|
||||
w := GetButtonWidth(b);
|
||||
end;
|
||||
b.AutoSize := true;
|
||||
w := Max(w, b.Width);
|
||||
h := b.Height;
|
||||
b.AutoSize := false;
|
||||
SnoozeBtn.AutoSize := true;
|
||||
h := SnoozeBtn.Height;
|
||||
if SnoozeBtn.Width > w then
|
||||
w := SnoozeBtn.Width;
|
||||
SnoozeBtn.AutoSize := false;
|
||||
|
||||
OpenItemBtn.AutoSize := true;
|
||||
if OpenItemBtn.Width > w then
|
||||
w := OpenItemBtn.Width;
|
||||
OpenItemBtn.AutoSize := false;
|
||||
|
||||
DismissBtn.AutoSize := true;
|
||||
if DismissBtn.Width > w then
|
||||
w := DismissBtn.Width;
|
||||
DismissBtn.AutoSize := false;
|
||||
|
||||
SnoozeBtn.Width := w;
|
||||
SnoozeBtn.Height := h;
|
||||
DismissBtn.Width := w;
|
||||
|
@ -59,6 +59,9 @@ const
|
||||
|
||||
GranularityMinutes: Array[TVpGranularity] of Integer = (5, 6, 10, 15, 20, 30, 60);
|
||||
|
||||
DesignTimeDPI = 96;
|
||||
|
||||
|
||||
function DefaultEpoch : Integer;
|
||||
{-return the current century}
|
||||
|
||||
@ -158,8 +161,8 @@ function GranularityToStr(Gran: TVpGranularity): string;
|
||||
|
||||
function TaskPriorityToStr(APriority: TVpTaskPriority): String;
|
||||
|
||||
function AutoHeight(ARadioGroup: TRadioGroup): Integer;
|
||||
function GetButtonWidth(AButton: TButton): Integer;
|
||||
//function AutoHeight(ARadioGroup: TRadioGroup): Integer;
|
||||
//function GetButtonWidth(AButton: TButton): Integer;
|
||||
function GetLabelWidth(ALabel: TLabel): Integer;
|
||||
function GetRealFontHeight(AFont: TFont): Integer;
|
||||
|
||||
@ -171,18 +174,11 @@ procedure AddResourceGroupMenu(AMenu: TMenuItem; AResource: TVpResource;
|
||||
AEventHandler: TNotifyEvent);
|
||||
function OverlayPatternToBrushStyle(APattern: TVpOverlayPattern): TBrushStyle;
|
||||
|
||||
{$IFDEF LCL}
|
||||
procedure HighDPI(FromDPI: integer);
|
||||
procedure ScaleDPI(Control: TControl; FromDPI: integer);
|
||||
|
||||
const
|
||||
DesignTimeDPI = 96;
|
||||
{$ENDIF}
|
||||
|
||||
procedure Unused(const A1); overload;
|
||||
procedure Unused(const A1, A2); overload;
|
||||
procedure Unused(const A1, A2, A3); overload;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
@ -785,6 +781,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
(*
|
||||
function AutoHeight(ARadioGroup: TRadioGroup): Integer;
|
||||
var
|
||||
w: Integer;
|
||||
@ -795,6 +792,7 @@ begin
|
||||
ARadioGroup.AutoSize := false;
|
||||
ARadioGroup.Width := w;
|
||||
end;
|
||||
*)
|
||||
|
||||
function GetLabelWidth(ALabel: TLabel): Integer;
|
||||
var
|
||||
@ -807,6 +805,7 @@ begin
|
||||
canvas.Free;
|
||||
end;
|
||||
|
||||
(*
|
||||
function GetButtonWidth(AButton: TButton): Integer;
|
||||
const
|
||||
MARGIN = 24;
|
||||
@ -819,7 +818,7 @@ begin
|
||||
Result := canvas.TextWidth(AButton.Caption) + MARGIN * Screen.PixelsPerInch div DesignTimeDPI;
|
||||
canvas.Free;
|
||||
end;
|
||||
|
||||
*)
|
||||
function GetRealFontHeight(AFont: TFont): Integer;
|
||||
begin
|
||||
if AFont.Size = 0 then
|
||||
@ -932,45 +931,6 @@ begin
|
||||
Result := TBrushStyle(APattern);
|
||||
end;
|
||||
|
||||
{$IFDEF LCL}
|
||||
procedure HighDPI(FromDPI: integer);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
if Screen.PixelsPerInch = FromDPI then
|
||||
exit;
|
||||
|
||||
for i := 0 to Screen.FormCount - 1 do
|
||||
ScaleDPI(Screen.Forms[i], FromDPI);
|
||||
end;
|
||||
|
||||
procedure ScaleDPI(Control: TControl; FromDPI: integer);
|
||||
var
|
||||
i: integer;
|
||||
WinControl: TWinControl;
|
||||
begin
|
||||
if Screen.PixelsPerInch = FromDPI then
|
||||
exit;
|
||||
|
||||
with Control do
|
||||
begin
|
||||
Left := ScaleX(Left, FromDPI);
|
||||
Top := ScaleY(Top, FromDPI);
|
||||
Width := ScaleX(Width, FromDPI);
|
||||
Height := ScaleY(Height, FromDPI);
|
||||
end;
|
||||
|
||||
if Control is TWinControl then
|
||||
begin
|
||||
WinControl := TWinControl(Control);
|
||||
if WinControl.ControlCount = 0 then
|
||||
exit;
|
||||
for i := 0 to WinControl.ControlCount - 1 do
|
||||
ScaleDPI(WinControl.Controls[i], FromDPI);
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{$PUSH}{$HINTS OFF}
|
||||
procedure Unused(const A1);
|
||||
begin
|
||||
|
@ -11,7 +11,7 @@ object TaskEditForm: TTaskEditForm
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.9.0.0'
|
||||
LCLVersion = '1.6.4.0'
|
||||
object ButtonPanel: TPanel
|
||||
Left = 0
|
||||
Height = 33
|
||||
@ -90,20 +90,25 @@ object TaskEditForm: TTaskEditForm
|
||||
ClientHeight = 369
|
||||
ClientWidth = 539
|
||||
object DueDateLbl: TLabel
|
||||
AnchorSideLeft.Control = imgCalendar
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = DueDateEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 52
|
||||
Left = 56
|
||||
Height = 15
|
||||
Top = 68
|
||||
Width = 50
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Due date:'
|
||||
FocusControl = DueDateEdit
|
||||
ParentColor = False
|
||||
end
|
||||
object LblCreatedOn: TLabel
|
||||
AnchorSideLeft.Control = DueDateLbl
|
||||
AnchorSideTop.Control = DueDateEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 52
|
||||
Left = 56
|
||||
Height = 15
|
||||
Top = 91
|
||||
Width = 61
|
||||
@ -112,8 +117,9 @@ object TaskEditForm: TTaskEditForm
|
||||
ParentColor = False
|
||||
end
|
||||
object LblCompletedOn: TLabel
|
||||
AnchorSideLeft.Control = CbPriority
|
||||
AnchorSideTop.Control = LblCreatedOn
|
||||
Left = 333
|
||||
Left = 326
|
||||
Height = 15
|
||||
Top = 91
|
||||
Width = 79
|
||||
@ -133,6 +139,7 @@ object TaskEditForm: TTaskEditForm
|
||||
Shape = bsTopLine
|
||||
end
|
||||
object imgCalendar: TImage
|
||||
AnchorSideLeft.Control = tabTask
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
@ -140,6 +147,7 @@ object TaskEditForm: TTaskEditForm
|
||||
Top = 64
|
||||
Width = 32
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
Picture.Data = {
|
||||
07544269746D6170360C0000424D360C00000000000036000000280000002000
|
||||
@ -245,9 +253,10 @@ object TaskEditForm: TTaskEditForm
|
||||
Transparent = True
|
||||
end
|
||||
object imgCompleted: TImage
|
||||
AnchorSideLeft.Control = LblPriority
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 290
|
||||
Left = 277
|
||||
Height = 32
|
||||
Top = 64
|
||||
Width = 32
|
||||
@ -297,9 +306,10 @@ object TaskEditForm: TTaskEditForm
|
||||
Text = 'DescriptionEdit'
|
||||
end
|
||||
object CbComplete: TCheckBox
|
||||
AnchorSideLeft.Control = CbPriority
|
||||
AnchorSideTop.Control = DueDateEdit
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 333
|
||||
Left = 326
|
||||
Height = 19
|
||||
Top = 66
|
||||
Width = 72
|
||||
@ -334,12 +344,14 @@ object TaskEditForm: TTaskEditForm
|
||||
TabOrder = 3
|
||||
end
|
||||
object DueDateEdit: TDateEdit
|
||||
AnchorSideLeft.Control = DueDateLbl
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Bevel1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 114
|
||||
Height = 23
|
||||
Top = 64
|
||||
Width = 120
|
||||
Width = 110
|
||||
CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames]
|
||||
DateOrder = doNone
|
||||
ButtonWidth = 23
|
||||
@ -352,21 +364,25 @@ object TaskEditForm: TTaskEditForm
|
||||
object LblCategory: TLabel
|
||||
AnchorSideTop.Control = CbCategory
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 62
|
||||
AnchorSideRight.Control = CbCategory
|
||||
Left = 55
|
||||
Height = 15
|
||||
Top = 35
|
||||
Width = 51
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'Category:'
|
||||
FocusControl = CbCategory
|
||||
ParentColor = False
|
||||
end
|
||||
object CbCategory: TComboBox
|
||||
AnchorSideLeft.Control = DueDateEdit
|
||||
AnchorSideTop.Control = DescriptionEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 128
|
||||
Left = 114
|
||||
Height = 23
|
||||
Top = 31
|
||||
Width = 120
|
||||
Width = 139
|
||||
BorderSpacing.Top = 4
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
@ -382,23 +398,29 @@ object TaskEditForm: TTaskEditForm
|
||||
Text = 'Business'
|
||||
end
|
||||
object LblPriority: TLabel
|
||||
AnchorSideLeft.Control = CbCategory
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CbPriority
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 281
|
||||
Left = 277
|
||||
Height = 15
|
||||
Top = 35
|
||||
Width = 41
|
||||
BorderSpacing.Left = 24
|
||||
Caption = 'Priority:'
|
||||
FocusControl = CbPriority
|
||||
ParentColor = False
|
||||
end
|
||||
object CbPriority: TComboBox
|
||||
AnchorSideLeft.Control = LblPriority
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = DescriptionEdit
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 333
|
||||
Left = 326
|
||||
Height = 23
|
||||
Top = 31
|
||||
Width = 120
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
ItemHeight = 15
|
||||
|
@ -82,7 +82,7 @@ type
|
||||
FResource: TVpResource;
|
||||
// FBtnHeight: Integer;
|
||||
// FBtnWidth: Integer;
|
||||
FEditHeight: Integer;
|
||||
// FEditHeight: Integer;
|
||||
procedure PositionControls;
|
||||
procedure SetCaptions;
|
||||
public
|
||||
@ -128,7 +128,7 @@ procedure TTaskEditForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FReturnCode := rtAbandon;
|
||||
// FBtnHeight := ScaleY(OKBtn.Height, DesignTimeDPI);
|
||||
FEditHeight := ScaleY(DueDateEdit.Height, DesignTimeDPI);
|
||||
// FEditHeight := ScaleY(DueDateEdit.Height, DesignTimeDPI);
|
||||
end;
|
||||
|
||||
procedure TTaskEditForm.DePopulateSelf;
|
||||
@ -184,72 +184,48 @@ end;
|
||||
|
||||
procedure TTaskEditForm.PositionControls;
|
||||
var
|
||||
VBevelDist: Integer = 8; // Distance bevel-to-control
|
||||
VDist: Integer = 8; // Vertical distance between controls
|
||||
HDist: Integer = 8; // Horizontal distance between controls:
|
||||
w: Integer;
|
||||
i, w: Integer;
|
||||
cnv: TControlCanvas;
|
||||
i: Integer;
|
||||
begin
|
||||
VBevelDist := ScaleY(VBevelDist, DesignTimeDPI);
|
||||
VDist := ScaleY(VDist, DesignTimeDPI);
|
||||
HDist := ScaleX(HDist, DesignTimeDPI);
|
||||
|
||||
for i := 0 to ComponentCount-1 do
|
||||
if Components[i] is TControl then
|
||||
with TControl(Components[i]) do begin
|
||||
if BorderSpacing.Left <> 0 then BorderSpacing.Left := HDist;
|
||||
if BorderSpacing.Right <> 0 then BorderSpacing.Right := HDist;
|
||||
if BorderSpacing.Top <> 0 then BorderSpacing.Top := VDist;
|
||||
if BorderSpacing.Bottom <> 0 then BorderSpacing.Bottom := VDist;
|
||||
end;
|
||||
|
||||
DescriptionEdit.Height := FEditHeight;
|
||||
DueDateEdit.Height := FEditHeight;
|
||||
AutoSize := false;
|
||||
DueDateEdit.ButtonWidth := DueDateEdit.Height;
|
||||
CbCategory.Height := FEditHeight;
|
||||
CbPriority.Height := FEditHeight;
|
||||
|
||||
ResourceNameLbl.Font.Size := ScaleY(ResourceNameLbl.Font.Size, DesignTimeDPI);
|
||||
|
||||
DueDateEdit.Left := DueDateLbl.Left + GetLabelWidth(DueDateLbl) + HDist;
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := DueDateEdit;
|
||||
cnv.Font.Assign(DueDateEdit.Font);
|
||||
w := cnv.TextWidth(' 99-99-9999 ') + DueDateEdit.ButtonWidth + 10;
|
||||
DueDateEdit.Width := w;
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
DueDateEdit.Width := w;
|
||||
|
||||
if RightOf(DueDateEdit) + 3*HDist > ImgCompleted.Left then begin
|
||||
ImgCompleted.Left := RightOf(DueDateEdit) + 3*HDist;
|
||||
CbComplete.Left := RightOf(ImgCompleted) + HDist;
|
||||
LblCompletedOn.Left := CbComplete.Left;
|
||||
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := CbComplete;
|
||||
cnv.Font.Assign(CbComplete.Font);
|
||||
w := cnv.TextWidth(CbComplete.Caption) + GetSystemMetrics(SM_CXMENUCHECK);
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
w := Max(GetlabelWidth(LblCompletedOn), w);
|
||||
ClientWidth := ClientWidth - tabTask.ClientWidth +
|
||||
Max(CbComplete.Left + w, RightOf(CbPriority)) +
|
||||
HDist*2;
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := CbCategory;
|
||||
cnv.Font.Assign(CbCategory.Font);
|
||||
w := 0;
|
||||
for i :=0 to CbCategory.Items.Count - 1 do
|
||||
w := max(w, cnv.TextWidth(CbCategory.Items[i]));
|
||||
inc(w, GetSystemMetrics(SM_CXVSCROLL)*2);
|
||||
w := Max(w, DueDateEdit.Width);
|
||||
CbCategory.Width := w;
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
|
||||
CbCategory.Left := DueDateEdit.Left;
|
||||
LblCategory.Left := CbCategory.Left - HDist - GetLabelWidth(LblCategory);
|
||||
|
||||
if RightOf(CbCategory) + 3*HDist + GetLabelWidth(LblPriority) + HDist > CbComplete.Left then
|
||||
CbPriority.Left := CbPriority.Parent.ClientWidth - HDist - CbPriority.Width
|
||||
else
|
||||
CbPriority.Left := CbComplete.Left;
|
||||
LblPriority.Left := CbPriority.Left - HDist - GetLabelWidth(LblPriority);
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := CbPriority;
|
||||
cnv.Font.Assign(CbPriority.Font);
|
||||
w := 0;
|
||||
for i :=0 to CbPriority.Items.Count - 1 do
|
||||
w := max(w, cnv.TextWidth(CbPriority.Items[i]));
|
||||
inc(w, GetSystemMetrics(SM_CXVSCROLL)*2);
|
||||
CbPriority.Width := w;
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
|
||||
AlignOKCancel(OKBtn, CancelBtn, ButtonPanel);
|
||||
|
||||
|
Reference in New Issue
Block a user