mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-21 13:59:10 +02:00
Refactoring TTaskDialog:
- Fix not displaying common buttons in TLCLTaskDialog.SetupControls - Assign TLCLDialog.FDlg in the CreateNew() constructor. - Free LDefaultFont - Start comparing the new form vs the old form Still not functional.
This commit is contained in:
parent
916196dede
commit
b163a35cb3
@ -230,6 +230,13 @@ begin
|
|||||||
//Result := TWSTaskDialogClass(WidgetSetClass).Execute(Self);
|
//Result := TWSTaskDialogClass(WidgetSetClass).Execute(Self);
|
||||||
FParentWindow := ParentWnd;
|
FParentWindow := ParentWnd;
|
||||||
|
|
||||||
|
|
||||||
|
//temporary show new, then old dialog, both in emulated mode (regardless of Flags)
|
||||||
|
LCLTaskDialog.TaskDialogIndirect := nil;
|
||||||
|
Result := TWSTaskDialogClass(WidgetSetClass).Execute(Self);
|
||||||
|
debugln(['TWSTaskDialogClass(WidgetSetClass).Execute(Self)=',Result]);
|
||||||
|
|
||||||
|
|
||||||
FillChar(TaskDlg, SizeOf(LCLTaskDialog.TTaskDialog), 0);
|
FillChar(TaskDlg, SizeOf(LCLTaskDialog.TTaskDialog), 0);
|
||||||
|
|
||||||
if RadioButtons.DefaultButton<> nil then
|
if RadioButtons.DefaultButton<> nil then
|
||||||
@ -258,10 +265,10 @@ begin
|
|||||||
DefRB, FWidth, ParentWnd, tfForceNonNative in Flags, tfEmulateClassicStyle in Flags, @DoOnButtonClickedHandler);
|
DefRB, FWidth, ParentWnd, tfForceNonNative in Flags, tfEmulateClassicStyle in Flags, @DoOnButtonClickedHandler);
|
||||||
Result := ButtonID>=0;
|
Result := ButtonID>=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FModalResult := ButtonIDToModalResult(ButtonID);
|
FModalResult := ButtonIDToModalResult(ButtonID);
|
||||||
|
|
||||||
|
//ToDo move FirstButtonIndex and FirstRadioButtonIndex to interface section Dialogs unit.
|
||||||
|
|
||||||
if (TaskDlg.RadioRes>=200) and (TaskDlg.RadioRes-200<RadioButtons.Count) then
|
if (TaskDlg.RadioRes>=200) and (TaskDlg.RadioRes-200<RadioButtons.Count) then
|
||||||
FRadioButton := RadioButtons[TaskDlg.RadioRes-200] as TTaskDialogRadioButtonItem
|
FRadioButton := RadioButtons[TaskDlg.RadioRes-200] as TTaskDialogRadioButtonItem
|
||||||
else
|
else
|
||||||
|
@ -159,7 +159,10 @@ end;
|
|||||||
|
|
||||||
constructor TLCLTaskDialog.CreateNew(AOwner: TComponent; Num: Integer);
|
constructor TLCLTaskDialog.CreateNew(AOwner: TComponent; Num: Integer);
|
||||||
begin
|
begin
|
||||||
|
debugln('TLCLTaskDialog.CreateNew: AOwner=',DbgSName(AOwner));
|
||||||
inherited CreateNew(AOwner, Num);
|
inherited CreateNew(AOwner, Num);
|
||||||
|
if (AOwner is TCustomTaskDialog) then
|
||||||
|
FDlg := TTaskDialog(AOwner);
|
||||||
Rad := nil;
|
Rad := nil;
|
||||||
KeyPreview := True;
|
KeyPreview := True;
|
||||||
end;
|
end;
|
||||||
@ -169,6 +172,7 @@ var
|
|||||||
mRes, I: Integer;
|
mRes, I: Integer;
|
||||||
aParent: HWND;
|
aParent: HWND;
|
||||||
begin
|
begin
|
||||||
|
debugln(['TLCLTaskDialog.Execute: Assigned(FDlg)=',Assigned(FDlg)]);
|
||||||
if not Assigned(FDlg) then
|
if not Assigned(FDlg) then
|
||||||
Exit(False);
|
Exit(False);
|
||||||
SetupControls;
|
SetupControls;
|
||||||
@ -684,7 +688,7 @@ begin
|
|||||||
|
|
||||||
|
|
||||||
// add buttons and verification checkbox
|
// add buttons and verification checkbox
|
||||||
if (aCommonButtons=[]) or (Verify<>'') or
|
if (aCommonButtons <> []) or (Verify<>'') or
|
||||||
((Buttons<>'') and not (tfUseCommandLinks in FDlg.Flags)) then
|
((Buttons<>'') and not (tfUseCommandLinks in FDlg.Flags)) then
|
||||||
begin
|
begin
|
||||||
CurrTabOrder := Panel.TabOrder;
|
CurrTabOrder := Panel.TabOrder;
|
||||||
@ -700,8 +704,10 @@ begin
|
|||||||
Free;
|
Free;
|
||||||
end;
|
end;
|
||||||
for Btn := high(TTaskDialogCommonButton) downto low(TTaskDialogCommonButton) do
|
for Btn := high(TTaskDialogCommonButton) downto low(TTaskDialogCommonButton) do
|
||||||
|
begin
|
||||||
if (Btn in aCommonButtons) then
|
if (Btn in aCommonButtons) then
|
||||||
AddButton(TD_Trans(LoadResString(TD_BTNS(Btn))), TD_BTNMOD[Btn]);
|
AddButton(TD_Trans(LoadResString(TD_BTNS(Btn))), TD_BTNMOD[Btn]);
|
||||||
|
end;
|
||||||
if Verify<>'' then
|
if Verify<>'' then
|
||||||
begin
|
begin
|
||||||
Verif := TCheckBox.Create(Self);
|
Verif := TCheckBox.Create(Self);
|
||||||
@ -771,6 +777,9 @@ begin
|
|||||||
inherited KeyDown(Key, Shift);
|
inherited KeyDown(Key, Shift);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
finalization
|
||||||
|
if assigned(LDefaultFont) then
|
||||||
|
LDefaultFont.Free;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -200,7 +200,7 @@ end;
|
|||||||
|
|
||||||
class function TWSTaskDialog.Execute(const ADlg: TCustomTaskDialog): Boolean;
|
class function TWSTaskDialog.Execute(const ADlg: TCustomTaskDialog): Boolean;
|
||||||
begin
|
begin
|
||||||
//writeln('TWSTaskDialog.Execute');
|
//writeln('TWSTaskDialog.Execute: Assigned(ADlg)=',Assigned(ADlg));
|
||||||
Result := ExecuteLCLTaskDialog(TTaskDialog(ADlg));
|
Result := ExecuteLCLTaskDialog(TTaskDialog(ADlg));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user