fixed IsFileExtensionSupported

git-svn-id: trunk@5249 -
This commit is contained in:
mattias 2004-03-01 18:02:00 +00:00
parent 53b08dab8d
commit 6a95f32a57
3 changed files with 26 additions and 13 deletions

View File

@ -23,7 +23,7 @@
<UsageCount Value="33"/>
</Unit0>
<Unit1>
<CursorPos X="3" Y="6"/>
<CursorPos X="21" Y="17"/>
<EditorIndex Value="0"/>
<Filename Value="mainform.pas"/>
<ComponentName Value="JPEGExampleForm"/>

View File

@ -1476,22 +1476,29 @@ var
StartPos: Integer;
EndPos: Integer;
i: Integer;
Ext: String;
begin
Result:=false;
if FileExtension='' then exit;
Extensions:=GetFileExtensions;
if Extensions='' then exit;
Ext:=FileExtension;
if Ext[1]='.' then begin
Ext:=copy(Ext,2,length(Ext));
if Ext='' then exit;
end;
StartPos:=1;
while StartPos<=length(Extensions) do begin
if not (Extensions[StartPos] in [';',' ']) then begin
EndPos:=StartPos;
while (EndPos<=length(Extensions)) and (Extensions[EndPos]<>';') do
inc(EndPos);
if EndPos-StartPos=length(FileExtension) then begin
if EndPos-StartPos=length(Ext) then begin
i:=1;
while (i<=length(FileExtension))
and (upcase(Extensions[StartPos+i-1])=upcase(FileExtension[i])) do
while (i<=length(Ext))
and (upcase(Extensions[StartPos+i-1])=upcase(Ext[i])) do
inc(i);
if i>length(FileExtension) then begin
if i>length(Ext) then begin
Result:=true;
exit;
end;
@ -1592,6 +1599,9 @@ end.
{ =============================================================================
$Log$
Revision 1.124 2004/03/01 18:02:00 mattias
fixed IsFileExtensionSupported
Revision 1.123 2004/02/29 22:51:54 mattias
added jpeg example

View File

@ -47,24 +47,23 @@ begin
FOldWorkingDir:=GetCurrentDir;
if FInitialDir<>'' then SetCurrentDir(FInitialDir);
try
FUserChoice := mrNone;
CNSendMessage(LM_CREATE, Self, nil);
Result:= DoExecute;
CNSendMessage(LM_DESTROY, Self, nil);
FHandle := 0;
Result:=inherited Execute;
finally
SetCurrentDir(FOldWorkingDir);
end;
end;
{------------------------------------------------------------------------------}
{ TFileDialog DoExecute }
{------------------------------------------------------------------------------}
{------------------------------------------------------------------------------
TFileDialog DoExecute
------------------------------------------------------------------------------}
procedure TFileDialog.SetHistoryList(const AValue: TStrings);
begin
FHistoryList.Assign(AValue);
end;
{------------------------------------------------------------------------------
procedure TFileDialog.SetDefaultExt(const AValue: string);
------------------------------------------------------------------------------}
procedure TFileDialog.SetDefaultExt(const AValue: string);
begin
FDefaultExt:=AValue;
@ -93,6 +92,7 @@ end;
{------------------------------------------------------------------------------}
procedure TFileDialog.SetFileName(const value : string);
begin
if FFilename=Value then exit;
FFileName := Value; // make sure this is defined first before the CNSendMessage
end;
@ -278,6 +278,9 @@ end;
{ =============================================================================
$Log$
Revision 1.18 2004/03/01 18:02:00 mattias
fixed IsFileExtensionSupported
Revision 1.17 2004/02/23 08:19:04 micha
revert intf split