[Lazarus] savedialog issue
Andrea Mauri
andrea.mauri.75 at gmail.com
Tue Jul 3 10:28:01 CEST 2012
Il 02/07/2012 15:56, Martin ha scritto:
>
> I don't know anything about the issue itself, but have you tried setting
> a watchpoint (context menu in watches list). (Scope = global / Acess write)
>
> Set the watchpoint after TCommonDialog.DoExecute has initialized the
> value. The watchpoint should stop execution if the value is modified
I tried to evaluate when FUserChoice is assigned 2 (mrCancel).
function TCommonDialog.DoExecute : boolean;
var
CanClose: boolean;
begin
FCanCloseCalled := False;
if Assigned(FOnShow) then
FOnShow(Self);
--> before this is FUserChoice=0 (mrNone)
TWSCommonDialogClass(WidgetSetClass).ShowModal(Self);
--> after this is FUserChoice=2 (mrCancel)
I look deeper and I found that in:
class procedure TWin32WSOpenDialog.VistaDialogShowModal(ADialog:
IFileDialog; const AOpenDialog: TOpenDialog);
var
FileDialogEvents: IFileDialogEvents;
Cookie: DWord;
CanClose: Boolean;
begin
FileDialogEvents := TFileDialogEvents.Create(AOpenDialog);
ADialog.Advise(FileDialogEvents, @Cookie);
try
AOpenDialog.DoShow;
repeat
ADialog.Show(GetParentWnd);
--> I set a breakpoint on the line below, the dialog is not shown,
UserChoice in the following 'if' line is mrNone, so different from mrOk
and then UserChoice is set to mrCancel
if (AOpenDialog.UserChoice <> mrOk) then
begin
CanClose := True;
AOpenDialog.DoCanClose(CanClose);
AOpenDialog.UserChoice := mrCancel;
end
else
CanClose := True;
until CanClose;
finally
ADialog.unadvise(Cookie);
FileDialogEvents := nil;
end;
end;
More information about the Lazarus
mailing list