options are sorted

This commit is contained in:
Basile Burg 2015-02-23 03:52:10 +01:00
parent 4e51c7bbe6
commit ca84243cfa
2 changed files with 8 additions and 0 deletions

View File

@ -40,6 +40,7 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
HideSelection = False
ReadOnly = True
ScrollBars = ssAutoBoth
SortType = stText
TabOrder = 0
OnDeletion = selCatDeletion
OnSelectionChanged = selCatSelectionChanged

View File

@ -41,6 +41,7 @@ type
private
fEdOptsSubj: TCEEditableOptionsSubject;
procedure updateCategories;
function sortCategories(Cat1, Cat2: TTreeNode): integer;
public
constructor create(aOwner: TComponent); override;
destructor destroy; override;
@ -100,6 +101,12 @@ begin
dt^.kind := ed.optionedWantEditorKind;
dt^.observer := ed;
end;
selCat.Items.SortTopLevelNodes(@sortCategories);
end;
function TCEOptionEditorWidget.sortCategories(Cat1, Cat2: TTreeNode): integer;
begin
result := CompareText(Cat1.Text, Cat2.Text);
end;
procedure TCEOptionEditorWidget.selCatDeletion(Sender: TObject; Node: TTreeNode);