IDE: Improved layout of the ToDoDlg. (Slightly modified) patch by Don Siders. Issue #40258

This commit is contained in:
wp_xyz 2023-05-12 20:19:46 +02:00
parent 1723f24e24
commit 8ae2cae749
2 changed files with 123 additions and 67 deletions

View File

@ -1,109 +1,126 @@
object TodoDialog: TTodoDialog object TodoDialog: TTodoDialog
Left = 186 Left = 224
Height = 244 Height = 230
Top = 86 Top = 127
Width = 384 Width = 361
ActiveControl = TodoMemo ActiveControl = TodoMemo
Caption = 'Insert Todo' Caption = 'Insert Todo'
ClientHeight = 244 ClientHeight = 230
ClientWidth = 384 ClientWidth = 361
Constraints.MinHeight = 190 Constraints.MinWidth = 360
Constraints.MinWidth = 384
OnCloseQuery = FormCloseQuery OnCloseQuery = FormCloseQuery
OnCreate = FormCreate OnCreate = FormCreate
OnShow = FormShow
Position = poScreenCenter Position = poScreenCenter
SessionProperties = 'chkAlternateTokens.Checked;rdoDone.Checked;rdoNote.Checked;rdoToDo.Checked;OwnerEdit.Text' SessionProperties = 'chkAlternateTokens.Checked;rdoDone.Checked;rdoNote.Checked;rdoToDo.Checked;OwnerEdit.Text'
ShowHint = True ShowHint = True
LCLVersion = '2.1.0.0' LCLVersion = '2.3.0.0'
object TodoLabel: TLabel object TodoLabel: TLabel
AnchorSideLeft.Control = Owner
AnchorSideTop.Control = Owner
Left = 8 Left = 8
Height = 15 Height = 15
Top = 8 Top = 4
Width = 25 Width = 24
BorderSpacing.Left = 8
BorderSpacing.Top = 4
BorderSpacing.Bottom = 2
Caption = 'Text:' Caption = 'Text:'
FocusControl = TodoMemo FocusControl = TodoMemo
ParentColor = False ParentColor = False
end end
object PriorityLabel: TLabel object PriorityLabel: TLabel
AnchorSideLeft.Control = TodoLabel AnchorSideLeft.Control = PriorityEdit
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = PriorityEdit AnchorSideBottom.Control = PriorityEdit
Left = 8 Left = 8
Height = 15 Height = 15
Top = 90 Top = 74
Width = 38 Width = 38
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Top = 4
BorderSpacing.Bottom = 2 BorderSpacing.Bottom = 2
Caption = 'Priority' Caption = 'Priority'
ParentColor = False ParentColor = False
end end
object OwnerLabel: TLabel object OwnerLabel: TLabel
AnchorSideTop.Control = PriorityLabel AnchorSideLeft.Control = OwnerEdit
Left = 77 AnchorSideBottom.Control = OwnerEdit
Left = 74
Height = 15 Height = 15
Top = 90 Top = 74
Width = 35 Width = 35
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 4
BorderSpacing.Bottom = 2
Caption = 'Owner' Caption = 'Owner'
ParentColor = False ParentColor = False
end end
object CategoryLabel: TLabel object CategoryLabel: TLabel
AnchorSideTop.Control = PriorityLabel AnchorSideLeft.Control = CategoryEdit
Left = 248 AnchorSideBottom.Control = CategoryEdit
Left = 217
Height = 15 Height = 15
Top = 90 Top = 74
Width = 48 Width = 48
Anchors = [akLeft, akBottom]
BorderSpacing.Top = 4
BorderSpacing.Bottom = 2
Caption = 'Category' Caption = 'Category'
ParentColor = False ParentColor = False
end end
object TodoMemo: TMemo object TodoMemo: TMemo
AnchorSideLeft.Control = TodoLabel AnchorSideLeft.Control = PriorityEdit
AnchorSideTop.Control = TodoLabel AnchorSideTop.Control = TodoLabel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner AnchorSideRight.Control = CategoryEdit
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = PriorityLabel AnchorSideBottom.Control = PriorityLabel
Left = 8 Left = 8
Height = 59 Height = 49
Top = 25 Top = 21
Width = 370 Width = 345
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
BorderSpacing.Bottom = 6
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
TabOrder = 0 TabOrder = 0
end end
object OwnerEdit: TEdit object OwnerEdit: TEdit
AnchorSideLeft.Control = OwnerLabel AnchorSideLeft.Control = PriorityEdit
AnchorSideTop.Control = OwnerLabel AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 77 AnchorSideRight.Control = Bevel2
AnchorSideBottom.Control = grpboxToDoType
Left = 74
Height = 23 Height = 23
Top = 107 Top = 91
Width = 162 Width = 135
BorderSpacing.Top = 2 Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Bottom = 8
TabOrder = 2 TabOrder = 2
end end
object CategoryEdit: TEdit object CategoryEdit: TEdit
AnchorSideLeft.Control = CategoryLabel AnchorSideLeft.Control = Bevel2
AnchorSideTop.Control = CategoryLabel AnchorSideLeft.Side = asrBottom
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom AnchorSideRight.Side = asrBottom
Left = 248 AnchorSideBottom.Control = grpboxToDoType
Left = 217
Height = 23 Height = 23
Top = 107 Top = 91
Width = 130 Width = 136
Anchors = [akTop, akLeft, akRight] Anchors = [akLeft, akRight, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Right = 8
BorderSpacing.Right = 6 BorderSpacing.Bottom = 8
TabOrder = 3 TabOrder = 3
end end
object BtnPanel: TButtonPanel object BtnPanel: TButtonPanel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
Left = 6 Left = 6
Height = 26 Height = 26
Top = 212 Top = 198
Width = 372 Width = 349
OKButton.Name = 'OKButton' OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton' HelpButton.Name = 'HelpButton'
@ -117,40 +134,36 @@ object TodoDialog: TTodoDialog
ShowBevel = False ShowBevel = False
end end
object PriorityEdit: TSpinEdit object PriorityEdit: TSpinEdit
AnchorSideLeft.Control = PriorityLabel AnchorSideLeft.Control = grpboxToDoType
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = grpboxToDoType AnchorSideBottom.Control = grpboxToDoType
Left = 8 Left = 8
Height = 23 Height = 23
Top = 107 Top = 91
Width = 58 Width = 58
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Top = 2 BorderSpacing.Bottom = 8
BorderSpacing.Bottom = 6
TabOrder = 1 TabOrder = 1
end end
object grpboxToDoType: TGroupBox object grpboxToDoType: TGroupBox
AnchorSideLeft.Control = PriorityLabel
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = CategoryEdit
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = chkAlternateTokens
Left = 8 Left = 8
Height = 45 Height = 45
Top = 136 Top = 122
Width = 370 Width = 345
Anchors = [akLeft, akRight, akBottom] Align = alBottom
AutoSize = True AutoSize = True
BorderSpacing.Bottom = 6 BorderSpacing.Left = 8
BorderSpacing.Right = 8
Caption = 'ToDo type' Caption = 'ToDo type'
ClientHeight = 25 ClientHeight = 25
ClientWidth = 366 ClientWidth = 341
TabOrder = 4 TabOrder = 4
object rdoToDo: TRadioButton object rdoToDo: TRadioButton
Left = 6 Left = 6
Height = 19 Height = 19
Top = 0 Top = 0
Width = 49 Width = 46
BorderSpacing.Left = 6 BorderSpacing.Left = 6
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'ToDo' Caption = 'ToDo'
@ -161,10 +174,12 @@ object TodoDialog: TTodoDialog
end end
object rdoDone: TRadioButton object rdoDone: TRadioButton
Tag = 1 Tag = 1
Left = 160 AnchorSideLeft.Control = grpboxToDoType
AnchorSideLeft.Side = asrCenter
Left = 149
Height = 19 Height = 19
Top = 0 Top = 0
Width = 48 Width = 46
Anchors = [akTop] Anchors = [akTop]
Caption = 'Done' Caption = 'Done'
OnChange = rdoToDoTypeChange OnChange = rdoToDoTypeChange
@ -172,34 +187,60 @@ object TodoDialog: TTodoDialog
end end
object rdoNote: TRadioButton object rdoNote: TRadioButton
Tag = 2 Tag = 2
Left = 311 AnchorSideRight.Control = grpboxToDoType
AnchorSideRight.Side = asrBottom
Left = 291
Height = 19 Height = 19
Top = 0 Top = 0
Width = 46 Width = 44
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
BorderSpacing.Right = 6
Caption = 'Note' Caption = 'Note'
OnChange = rdoToDoTypeChange OnChange = rdoToDoTypeChange
TabOrder = 2 TabOrder = 2
end end
end end
object chkAlternateTokens: TCheckBox object chkAlternateTokens: TCheckBox
AnchorSideLeft.Control = grpboxToDoType
AnchorSideTop.Side = asrBottom AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = BtnPanel
Left = 8 Left = 8
Height = 19 Height = 19
Top = 187 Top = 173
Width = 128 Width = 345
Align = alBottom
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
BorderSpacing.Left = 8
BorderSpacing.Top = 6
BorderSpacing.Right = 8
BorderSpacing.Bottom = 6 BorderSpacing.Bottom = 6
Caption = 'UseAlternate Tokens' Caption = 'UseAlternate Tokens'
TabOrder = 5 TabOrder = 5
end end
object Bevel1: TBevel
AnchorSideLeft.Control = OwnerEdit
AnchorSideRight.Control = CategoryEdit
AnchorSideRight.Side = asrBottom
Left = 74
Height = 21
Top = 107
Width = 279
Anchors = [akLeft, akRight, akBottom]
Shape = bsSpacer
end
object Bevel2: TBevel
AnchorSideLeft.Control = Bevel1
AnchorSideLeft.Side = asrCenter
Left = 209
Height = 16
Top = 72
Width = 8
Anchors = [akLeft, akBottom]
Shape = bsSpacer
end
object XMLPropStorage: TXMLPropStorage object XMLPropStorage: TXMLPropStorage
StoredValues = <> StoredValues = <>
FileName = 'todolistdialogoptions.xml' FileName = 'todolistdialogoptions.xml'
Active = False Active = False
left = 224 Left = 168
top = 8 Top = 24
end end
end end

View File

@ -50,6 +50,8 @@ type
{ TTodoDialog } { TTodoDialog }
TTodoDialog = class(TForm) TTodoDialog = class(TForm)
Bevel1: TBevel;
Bevel2: TBevel;
BtnPanel: TButtonPanel; BtnPanel: TButtonPanel;
chkAlternateTokens: TCheckBox; chkAlternateTokens: TCheckBox;
grpboxToDoType: TGroupBox; grpboxToDoType: TGroupBox;
@ -67,6 +69,7 @@ type
XMLPropStorage: TXMLPropStorage; XMLPropStorage: TXMLPropStorage;
procedure FormCloseQuery(Sender: TObject; var {%H-}CanClose: Boolean); procedure FormCloseQuery(Sender: TObject; var {%H-}CanClose: Boolean);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure rdoToDoTypeChange(Sender: TObject); procedure rdoToDoTypeChange(Sender: TObject);
end; end;
@ -197,6 +200,18 @@ begin
XMLPropStorage.Active := True; XMLPropStorage.Active := True;
end; end;
procedure TTodoDialog.FormShow(Sender: TObject);
begin
TodoMemo.Constraints.MinHeight := OwnerEdit.Height;
Constraints.MinHeight := ToDoMemo.Top + ToDoMemo.Constraints.MinHeight +
ClientHeight - PriorityLabel.Top + PriorityLabel.BorderSpacing.Top;
// Constraints.MinWidth is set in Object Inspector for LCL scaling
// Enforce constraints
if Width < Constraints.MinWidth then Width := 0;
if Height < Constraints.MinHeight then Height := 0;
end;
procedure TTodoDialog.FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure TTodoDialog.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin begin
XMLPropStorage.Save; XMLPropStorage.Save;