OSDN Git Service

カテゴリで取るときにカテゴリでソートするように変更。
authorh677 <h677>
Sun, 15 Jan 2006 16:44:50 +0000 (16:44 +0000)
committerh677 <h677>
Sun, 15 Jan 2006 16:44:50 +0000 (16:44 +0000)
InputAssistDataModule.pas

index 175f16c..e32220a 100644 (file)
@@ -17,6 +17,7 @@ type
        FDictionary : TStringList;      ///< \93o\98^\92P\8cê\82Æ\92è\8c^\95\82Ì\8e«\8f\91
        function GetSorted: Boolean;    ///< \83\\81[\83g\82Ì\8fó\91Ô\82Ì\8eæ\93¾
        procedure SetSorted(Value: Boolean);    ///< \83\\81[\83g\8fó\91Ô\82Ì\90Ý\92è
+
   public
        { Public \90é\8c¾ }
        property Sorted : Boolean read GetSorted write SetSorted;
@@ -49,6 +50,8 @@ type
        property Category: String read FCategory write FCategory;
        property Text: String read GetText write SetText;
   end;
+
+  function CategorySort(List: TStringList; Index1, Index2: Integer): Integer;
 var
   InputAssistDM: TInputAssistDM;
 
@@ -285,8 +288,10 @@ begin
                                                                resWord.GetCategory + ')', resWord);
                        end;
                end;
+               list.CustomSort(CategorySort);
        end;
 end;
+
 //! \83\\81[\83g\82Ì\8fó\91Ô\82Ì\8eæ\93¾
 function TInputAssistDM.GetSorted: Boolean;
 begin
@@ -303,4 +308,22 @@ begin
        end;
 end;
 
+//! Key\82ð\83J\83e\83S\83\8a\82É\8e\9d\82Â\93o\98^\92P\8cê\82ð\95Ô\82·\8e\9e\82Ì\83\\81[\83g\97p\94ä\8ar\83\81\83\\83b\83h
+function CategorySort(List: TStringList; Index1, Index2: Integer): Integer;
+var
+       resWord1 : TResistWord;
+       resWord2 : TResistWord;
+begin
+       Result := 0;
+       try
+               resWord1 := TResistWord(List.Objects[Index1]);
+               resWord2 := TResistWord(List.Objects[Index2]);
+               Result := AnsiCompareStr(resWord1.GetCategory, resWord2.GetCategory);
+               if (Result = 0) then begin
+                       Result := AnsiCompareStr(resWord1.GetKey, resWord2.GetKey);
+               end;
+       except
+       end;
+end;
+
 end.