ToDoList: Use TSpinEdit for item Priority. Improve anchoring.

git-svn-id: trunk@45735 -
This commit is contained in:
juha 2014-06-30 11:01:35 +00:00
parent 9a0aef19e2
commit 4f1d01fd5b
2 changed files with 58 additions and 58 deletions

View File

@ -1,31 +1,31 @@
object TodoDialog: TTodoDialog
Left = 342
Height = 267
Height = 266
Top = 202
Width = 475
Width = 482
ActiveControl = TodoMemo
Caption = 'Insert Todo'
ClientHeight = 267
ClientWidth = 475
ClientHeight = 266
ClientWidth = 482
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '0.9.31'
LCLVersion = '1.3'
object TodoLabel: TLabel
Left = 8
Height = 18
Height = 15
Top = 8
Width = 30
Width = 28
Caption = 'Text:'
FocusControl = TodoMemo
ParentColor = False
end
object PriorityLabel: TLabel
AnchorSideLeft.Control = TodoLabel
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Control = PriorityEdit
Left = 10
Height = 18
Top = 179
Width = 45
Left = 8
Height = 15
Top = 181
Width = 44
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 2
Caption = 'Priority'
@ -33,32 +33,33 @@ object TodoDialog: TTodoDialog
end
object OwnerLabel: TLabel
AnchorSideTop.Control = PriorityLabel
Left = 75
Height = 18
Top = 179
Width = 41
Left = 77
Height = 15
Top = 181
Width = 39
Caption = 'Owner'
ParentColor = False
end
object CategoryLabel: TLabel
AnchorSideTop.Control = PriorityLabel
Left = 248
Height = 18
Top = 179
Width = 59
Height = 15
Top = 181
Width = 57
Caption = 'Category'
ParentColor = False
end
object TodoMemo: TMemo
AnchorSideLeft.Control = TodoLabel
AnchorSideTop.Control = TodoLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = PriorityLabel
Left = 6
Height = 145
Top = 28
Width = 463
Left = 8
Height = 150
Top = 25
Width = 468
Anchors = [akTop, akLeft, akRight, akBottom]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
@ -66,42 +67,36 @@ object TodoDialog: TTodoDialog
ScrollBars = ssAutoBoth
TabOrder = 0
end
object PriorityEdit: TEdit
AnchorSideTop.Side = asrBottom
Left = 6
Height = 27
Top = 199
Width = 38
Anchors = [akLeft, akBottom]
BorderSpacing.Bottom = 6
OnKeyPress = PriorityEditKeyPress
TabOrder = 1
end
object OwnerEdit: TEdit
AnchorSideTop.Control = PriorityEdit
Left = 76
Height = 27
Top = 199
AnchorSideLeft.Control = OwnerLabel
AnchorSideTop.Control = OwnerLabel
AnchorSideTop.Side = asrBottom
Left = 77
Height = 25
Top = 198
Width = 162
BorderSpacing.Top = 2
TabOrder = 2
end
object CategoryEdit: TEdit
AnchorSideTop.Control = PriorityEdit
AnchorSideRight.Control = Owner
AnchorSideLeft.Control = CategoryLabel
AnchorSideTop.Control = CategoryLabel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 248
Height = 27
Top = 199
Width = 221
Height = 25
Top = 198
Width = 228
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 2
BorderSpacing.Right = 6
TabOrder = 3
end
object BtnPanel: TButtonPanel
Left = 6
Height = 36
Top = 225
Width = 463
Height = 33
Top = 227
Width = 470
OKButton.Name = 'OKButton'
OKButton.DefaultCaption = True
HelpButton.Name = 'HelpButton'
@ -114,4 +109,16 @@ object TodoDialog: TTodoDialog
ShowButtons = [pbOK, pbCancel]
ShowBevel = False
end
object PriorityEdit: TSpinEdit
AnchorSideLeft.Control = PriorityLabel
AnchorSideTop.Control = PriorityLabel
AnchorSideTop.Side = asrBottom
Left = 8
Height = 25
Top = 198
Width = 58
BorderSpacing.Top = 2
BorderSpacing.Bottom = 6
TabOrder = 1
end
end

View File

@ -30,8 +30,9 @@ interface
uses
Classes, SysUtils, LCLProc, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, TodoList, ToDoListStrConsts, Buttons, ButtonPanel, Menus, MenuIntf,
PackageIntf, SrcEditorIntf, IDECommands, LCLType, IDEWindowIntf, LazIDEIntf;
ExtCtrls, Buttons, ButtonPanel, Menus, Spin,
TodoList, ToDoListStrConsts, IDECommands, LCLType,
MenuIntf, PackageIntf, SrcEditorIntf, IDEWindowIntf, LazIDEIntf;
type
@ -42,13 +43,12 @@ type
OwnerEdit: TEdit;
CategoryEdit: TEdit;
CategoryLabel: TLabel;
PriorityEdit: TEdit;
PriorityEdit: TSpinEdit;
PriorityLabel: TLabel;
OwnerLabel: TLabel;
TodoLabel: TLabel;
TodoMemo: TMemo;
procedure FormCreate(Sender: TObject);
procedure PriorityEditKeyPress(Sender: TObject; var Key: char);
private
public
@ -153,12 +153,6 @@ end;
{ TTodoDialog }
procedure TTodoDialog.PriorityEditKeyPress(Sender: TObject; var Key: char);
begin
if not (Key in ['0'..'9']) then
Key := #0;
end;
procedure TTodoDialog.FormCreate(Sender: TObject);
begin
ActiveControl:=TodoMemo;
@ -185,8 +179,7 @@ begin
Result.Done := False;
Result.Owner := aTodoDialog.OwnerEdit.Text;
Result.Text := aTodoDialog.TodoMemo.Text;
if TryStrToInt(aTodoDialog.PriorityEdit.Text, aPriority) then
Result.Priority := aPriority;
Result.Priority := aTodoDialog.PriorityEdit.Value;
end;
aTodoDialog.Free;
end;