mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-31 14:16:11 +02:00
Moves the code to set the initial dir for win32 from the LCL to the win32 widgetset. Fixes bug #17772
git-svn-id: trunk@28055 -
This commit is contained in:
parent
65fda5bbfe
commit
56f71a1c43
@ -113,7 +113,6 @@ type
|
|||||||
FFilterIndex: Integer;
|
FFilterIndex: Integer;
|
||||||
FHistoryList: TStrings;
|
FHistoryList: TStrings;
|
||||||
FInitialDir: string;
|
FInitialDir: string;
|
||||||
FOldWorkingDir: string;
|
|
||||||
FOnHelpClicked: TNotifyEvent;
|
FOnHelpClicked: TNotifyEvent;
|
||||||
FOnTypeChange: TNotifyEvent;
|
FOnTypeChange: TNotifyEvent;
|
||||||
procedure SetDefaultExt(const AValue: string);
|
procedure SetDefaultExt(const AValue: string);
|
||||||
|
@ -56,13 +56,7 @@ end;
|
|||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
function TFileDialog.Execute : boolean;
|
function TFileDialog.Execute : boolean;
|
||||||
begin
|
begin
|
||||||
FOldWorkingDir:=GetCurrentDirUTF8;
|
Result:=inherited Execute;
|
||||||
if FInitialDir<>'' then SetCurrentDirUTF8(FInitialDir);
|
|
||||||
try
|
|
||||||
Result:=inherited Execute;
|
|
||||||
finally
|
|
||||||
SetCurrentDirUTF8(FOldWorkingDir);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
|
@ -723,11 +723,15 @@ end;
|
|||||||
class procedure TWin32WSOpenDialog.ShowModal(const ACommonDialog: TCommonDialog);
|
class procedure TWin32WSOpenDialog.ShowModal(const ACommonDialog: TCommonDialog);
|
||||||
var
|
var
|
||||||
State: TApplicationState;
|
State: TApplicationState;
|
||||||
|
lOldWorkingDir, lInitialDir: string;
|
||||||
begin
|
begin
|
||||||
if ACommonDialog.Handle <> 0 then
|
if ACommonDialog.Handle <> 0 then
|
||||||
begin
|
begin
|
||||||
State := SaveApplicationState;
|
State := SaveApplicationState;
|
||||||
|
lOldWorkingDir:=GetCurrentDirUTF8;
|
||||||
try
|
try
|
||||||
|
lInitialDir := TOpenDialog(ACommonDialog).InitialDir;
|
||||||
|
if lInitialDir <>'' then SetCurrentDirUTF8(lInitialDir);
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
if UnicodeEnabledOS then
|
if UnicodeEnabledOS then
|
||||||
ProcessFileDialogResult(TOpenDialog(ACommonDialog),
|
ProcessFileDialogResult(TOpenDialog(ACommonDialog),
|
||||||
@ -740,6 +744,7 @@ begin
|
|||||||
GetOpenFileName(LPOPENFILENAME(ACommonDialog.Handle)));
|
GetOpenFileName(LPOPENFILENAME(ACommonDialog.Handle)));
|
||||||
{$endif}
|
{$endif}
|
||||||
finally
|
finally
|
||||||
|
SetCurrentDirUTF8(lOldWorkingDir);
|
||||||
RestoreApplicationState(State);
|
RestoreApplicationState(State);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -750,11 +755,15 @@ end;
|
|||||||
class procedure TWin32WSSaveDialog.ShowModal(const ACommonDialog: TCommonDialog);
|
class procedure TWin32WSSaveDialog.ShowModal(const ACommonDialog: TCommonDialog);
|
||||||
var
|
var
|
||||||
State: TApplicationState;
|
State: TApplicationState;
|
||||||
|
lOldWorkingDir, lInitialDir: string;
|
||||||
begin
|
begin
|
||||||
if ACommonDialog.Handle <> 0 then
|
if ACommonDialog.Handle <> 0 then
|
||||||
begin
|
begin
|
||||||
State := SaveApplicationState;
|
State := SaveApplicationState;
|
||||||
|
lOldWorkingDir:=GetCurrentDirUTF8;
|
||||||
try
|
try
|
||||||
|
lInitialDir := TSaveDialog(ACommonDialog).InitialDir;
|
||||||
|
if lInitialDir <>'' then SetCurrentDirUTF8(lInitialDir);
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
if UnicodeEnabledOS then
|
if UnicodeEnabledOS then
|
||||||
ProcessFileDialogResult(TOpenDialog(ACommonDialog),
|
ProcessFileDialogResult(TOpenDialog(ACommonDialog),
|
||||||
@ -767,6 +776,7 @@ begin
|
|||||||
GetSaveFileName(LPOPENFILENAME(ACommonDialog.Handle)));
|
GetSaveFileName(LPOPENFILENAME(ACommonDialog.Handle)));
|
||||||
{$endif}
|
{$endif}
|
||||||
finally
|
finally
|
||||||
|
SetCurrentDirUTF8(lOldWorkingDir);
|
||||||
RestoreApplicationState(State);
|
RestoreApplicationState(State);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user