Changeset 240
- Timestamp:
- May 4, 2011, 1:21:07 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/UCommon.pas
r146 r240 4 4 5 5 uses 6 Windows, Classes, SysUtils, SpecializedList, StrUtils ; //, ShFolder, ShellAPI;6 Windows, Classes, SysUtils, SpecializedList, StrUtils, Dialogs; //, ShFolder, ShellAPI; 7 7 8 8 type … … 43 43 function LastPos(const SubStr: String; const S: String): Integer; 44 44 function GenerateNewName(OldName: string): string; 45 function GetFileFilterItemExt(Filter: string; Index: Integer): string; 46 procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog); 47 45 48 46 49 implementation 50 51 function GetFileFilterItemExt(Filter: string; Index: Integer): string; 52 var 53 List: TStringList; 54 begin 55 try 56 List := TStringList.Create; 57 List.Text := StringReplace(Filter, '|', #10, [rfReplaceAll]); 58 Result := List[Index * 2 + 1]; 59 finally 60 List.Free; 61 end; 62 end; 63 64 procedure FileDialogUpdateFilterFileType(FileDialog: TOpenDialog); 65 var 66 FileExt: string; 67 begin 68 FileExt := GetFileFilterItemExt(FileDialog.Filter, FileDialog.FilterIndex - 1); 69 Delete(FileExt, 1, 1); // Remove symbol '*' 70 if FileExt <> '.*' then 71 FileDialog.FileName := ChangeFileExt(FileDialog.FileName, FileExt) 72 end; 47 73 48 74 function GenerateNewName(OldName: string): string;
Note:
See TracChangeset
for help on using the changeset viewer.