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 HideSelection = False
ReadOnly = True ReadOnly = True
ScrollBars = ssAutoBoth ScrollBars = ssAutoBoth
SortType = stText
TabOrder = 0 TabOrder = 0
OnDeletion = selCatDeletion OnDeletion = selCatDeletion
OnSelectionChanged = selCatSelectionChanged OnSelectionChanged = selCatSelectionChanged

View File

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