todo list, keeo selection on focus lost

This commit is contained in:
Basile Burg 2018-05-14 15:36:22 +02:00
parent b10acf3ce8
commit a3a94df7ea
2 changed files with 15 additions and 12 deletions

View File

@ -13,14 +13,14 @@ inherited CETodoListWidget: TCETodoListWidget
ClientHeight = 337 ClientHeight = 337
ClientWidth = 584 ClientWidth = 584
inherited Content: TPanel inherited Content: TPanel
Height = 303 Height = 301
Top = 34 Top = 36
Width = 584 Width = 584
ClientHeight = 303 ClientHeight = 301
ClientWidth = 584 ClientWidth = 584
object lstItems: TListView[0] object lstItems: TListView[0]
Left = 4 Left = 4
Height = 295 Height = 293
Top = 4 Top = 4
Width = 576 Width = 576
Align = alClient Align = alClient
@ -29,31 +29,32 @@ inherited CETodoListWidget: TCETodoListWidget
item item
AutoSize = True AutoSize = True
Caption = 'text' Caption = 'text'
Width = 36 Width = 38
end end
item item
AutoSize = True AutoSize = True
Caption = 'category' Caption = 'category'
Width = 67 Width = 69
end end
item item
AutoSize = True AutoSize = True
Caption = 'assignee' Caption = 'assignee'
Width = 68 Width = 70
end end
item item
AutoSize = True AutoSize = True
Caption = 'status' Caption = 'status'
Width = 52
end end
item item
AutoSize = True AutoSize = True
Caption = 'priority' Caption = 'priority'
Width = 57 Width = 59
end end
item item
AutoSize = True AutoSize = True
Caption = 'file' Caption = 'file'
Width = 278 Width = 266
end> end>
ReadOnly = True ReadOnly = True
SortType = stText SortType = stText
@ -62,7 +63,6 @@ inherited CETodoListWidget: TCETodoListWidget
end end
end end
inherited toolbar: TCEToolBar inherited toolbar: TCEToolBar
Height = 28
Width = 576 Width = 576
object btnGo: TCEToolButton[0] object btnGo: TCEToolButton[0]
Left = 29 Left = 29
@ -84,7 +84,7 @@ inherited CETodoListWidget: TCETodoListWidget
end end
object lstfilter: TListFilterEdit[2] object lstfilter: TListFilterEdit[2]
Left = 61 Left = 61
Height = 24 Height = 26
Hint = 'filter the TODO items that contain the text typed here' Hint = 'filter the TODO items that contain the text typed here'
Top = 2 Top = 2
Width = 513 Width = 513

View File

@ -554,6 +554,7 @@ var
begin begin
if lstItems.Selected.isNil or lstItems.Selected.Data.isNil then if lstItems.Selected.isNil or lstItems.Selected.Data.isNil then
exit; exit;
// the collection will be cleared if a file is opened // the collection will be cleared if a file is opened
// docFocused->callToolProcess->fTodos....clear // docFocused->callToolProcess->fTodos....clear
// so line and filename must be copied // so line and filename must be copied
@ -561,9 +562,11 @@ begin
fname := itm.filename; fname := itm.filename;
ln := itm.line; ln := itm.line;
getMultiDocHandler.openDocument(fname); getMultiDocHandler.openDocument(fname);
//
if fDoc.isNil then if fDoc.isNil then
exit; exit;
fDoc.setFocus;
fDoc.CaretY := StrToInt(ln); fDoc.CaretY := StrToInt(ln);
fDoc.SelectLine; fDoc.SelectLine;
end; end;