mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-09 21:56:00 +02:00
TaskDialog: work in progress on expanding/collapsing the emulated dialog.
This commit is contained in:
parent
70b158940e
commit
d1ac727ad0
@ -25,6 +25,7 @@ type
|
|||||||
/// the Task Dialog structure which created the form
|
/// the Task Dialog structure which created the form
|
||||||
FDlg: TTaskDialog;
|
FDlg: TTaskDialog;
|
||||||
FVerifyChecked: Boolean;
|
FVerifyChecked: Boolean;
|
||||||
|
FExpanded: Boolean;
|
||||||
Timer: TTimer;
|
Timer: TTimer;
|
||||||
TimerStartTime: TTime;
|
TimerStartTime: TTime;
|
||||||
RadioButtonArray: array of TRadioButton;
|
RadioButtonArray: array of TRadioButton;
|
||||||
@ -45,6 +46,9 @@ type
|
|||||||
QueryEdit: TEdit;
|
QueryEdit: TEdit;
|
||||||
/// the Task Dialog optional checkbox
|
/// the Task Dialog optional checkbox
|
||||||
VerifyCheckBox: TCheckBox;
|
VerifyCheckBox: TCheckBox;
|
||||||
|
/// the Expand/Collaps button
|
||||||
|
ExpandBtn: TButton;
|
||||||
|
|
||||||
|
|
||||||
procedure AddIcon(out IconBorder,X,Y: Integer; AParent: TWinControl);
|
procedure AddIcon(out IconBorder,X,Y: Integer; AParent: TWinControl);
|
||||||
procedure AddPanel;
|
procedure AddPanel;
|
||||||
@ -59,6 +63,8 @@ type
|
|||||||
procedure AddQueryEdit(var X,Y: Integer; AWidth: Integer; AParent: TWinControl);
|
procedure AddQueryEdit(var X,Y: Integer; AWidth: Integer; AParent: TWinControl);
|
||||||
procedure SetupTimer;
|
procedure SetupTimer;
|
||||||
procedure ResetTimer;
|
procedure ResetTimer;
|
||||||
|
procedure ExpandDialog;
|
||||||
|
procedure CollapsDialog;
|
||||||
|
|
||||||
procedure DoDialogConstructed;
|
procedure DoDialogConstructed;
|
||||||
procedure DoDialogCreated;
|
procedure DoDialogCreated;
|
||||||
@ -67,6 +73,7 @@ type
|
|||||||
procedure OnRadioButtonClick(Sender: TObject);
|
procedure OnRadioButtonClick(Sender: TObject);
|
||||||
procedure OnVerifyClicked(Sender: TObject);
|
procedure OnVerifyClicked(Sender: TObject);
|
||||||
procedure OnTimer(Sender: TObject);
|
procedure OnTimer(Sender: TObject);
|
||||||
|
procedure OnExpandButtonClicked(Sender: TObject);
|
||||||
procedure DoOnHelp;
|
procedure DoOnHelp;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@ -240,6 +247,7 @@ begin
|
|||||||
|
|
||||||
inherited CreateNew(AOwner, Num);
|
inherited CreateNew(AOwner, Num);
|
||||||
RadioButtonArray := nil;
|
RadioButtonArray := nil;
|
||||||
|
FExpanded := False;
|
||||||
KeyPreview := True;
|
KeyPreview := True;
|
||||||
DoDialogCreated;
|
DoDialogCreated;
|
||||||
end;
|
end;
|
||||||
@ -520,7 +528,6 @@ procedure TLCLTaskDialog.AddExpandButton(var X, Y, XB: Integer;
|
|||||||
var
|
var
|
||||||
CurrTabOrder: TTabOrder;
|
CurrTabOrder: TTabOrder;
|
||||||
WB, AHeight: Integer;
|
WB, AHeight: Integer;
|
||||||
Btn: TButton;
|
|
||||||
begin
|
begin
|
||||||
CurrTabOrder := Panel.TabOrder;
|
CurrTabOrder := Panel.TabOrder;
|
||||||
//inc(Y, 16);
|
//inc(Y, 16);
|
||||||
@ -538,27 +545,30 @@ begin
|
|||||||
if (CollapsButtonCaption = '') then
|
if (CollapsButtonCaption = '') then
|
||||||
CollapsButtonCaption := ExpandButtonCaption;
|
CollapsButtonCaption := ExpandButtonCaption;
|
||||||
WB := Max(Canvas.TextWidth(ExpandButtonCaption), Canvas.TextWidth(CollapsButtonCaption)) +32;//52;
|
WB := Max(Canvas.TextWidth(ExpandButtonCaption), Canvas.TextWidth(CollapsButtonCaption)) +32;//52;
|
||||||
debugln([' X+WB=', X+WB]);
|
//debugln([' X+WB=', X+WB]);
|
||||||
debugln([' XB=', XB]);
|
//debugln([' XB=', XB]);
|
||||||
debugln([' diff=', X+WB-XB]);
|
//debugln([' diff=', X+WB-XB]);
|
||||||
if (X+WB > XB) then
|
if (X+WB > XB) then
|
||||||
begin
|
begin
|
||||||
debugln('TLCLTaskDialog.AddExpandButton: too wide');
|
//debugln('TLCLTaskDialog.AddExpandButton: too wide');
|
||||||
inc(Y,32);
|
inc(Y,32);
|
||||||
XB := aWidth;
|
XB := aWidth;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Btn := TButton.Create(Self);
|
ExpandBtn := TButton.Create(Self);
|
||||||
Btn.Parent := AParent;
|
ExpandBtn.Parent := AParent;
|
||||||
if (tfEmulateClassicStyle in FDlg.Flags) then
|
if (tfEmulateClassicStyle in FDlg.Flags) then
|
||||||
AHeight := 22
|
AHeight := 22
|
||||||
else
|
else
|
||||||
AHeight := 28;
|
AHeight := 28;
|
||||||
Btn.SetBounds(X,Y,WB-12,AHeight);
|
ExpandBtn.SetBounds(X,Y,WB-12,AHeight);
|
||||||
Btn.Caption := ExpandButtonCaption;
|
if not (tfExpandedByDefault in FDlg.Flags) then
|
||||||
Btn.ModalResult := mrNone;
|
ExpandBtn.Caption := ExpandButtonCaption
|
||||||
Btn.TabOrder := CurrTabOrder;
|
else
|
||||||
//Btn.OnClick := @OnButtonClicked;
|
ExpandBtn.Caption := CollapsButtonCaption;
|
||||||
|
ExpandBtn.ModalResult := mrNone;
|
||||||
|
ExpandBtn.TabOrder := CurrTabOrder;
|
||||||
|
ExpandBtn.OnClick := @OnExpandButtonClicked;
|
||||||
Inc(Y, AHeight+8);
|
Inc(Y, AHeight+8);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -682,6 +692,19 @@ begin
|
|||||||
inc(Y,42);
|
inc(Y,42);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLCLTaskDialog.OnExpandButtonClicked(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not FExpanded then
|
||||||
|
ExpandDialog
|
||||||
|
else
|
||||||
|
CollapsDialog;
|
||||||
|
FExpanded := not FExpanded;
|
||||||
|
{$PUSH}
|
||||||
|
{$ObjectChecks OFF}
|
||||||
|
{%H-}TTaskDialogAccess(FDlg).DoOnExpandButtonClicked(FExpanded);
|
||||||
|
{$POP}
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLCLTaskDialog.OnTimer(Sender: TObject);
|
procedure TLCLTaskDialog.OnTimer(Sender: TObject);
|
||||||
var
|
var
|
||||||
AResetTimer: Boolean;
|
AResetTimer: Boolean;
|
||||||
@ -736,6 +759,18 @@ begin
|
|||||||
Timer.Enabled := True;
|
Timer.Enabled := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLCLTaskDialog.ExpandDialog;
|
||||||
|
begin
|
||||||
|
ExpandBtn.Caption := ExpandButtonCaption;
|
||||||
|
//ToDo: actually expand the dialog
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLCLTaskDialog.CollapsDialog;
|
||||||
|
begin
|
||||||
|
ExpandBtn.Caption := CollapsButtonCaption;
|
||||||
|
//ToDo: actually collaps the dialog
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLCLTaskDialog.DoDialogConstructed;
|
procedure TLCLTaskDialog.DoDialogConstructed;
|
||||||
begin
|
begin
|
||||||
{$PUSH}
|
{$PUSH}
|
||||||
@ -950,6 +985,8 @@ begin
|
|||||||
else
|
else
|
||||||
if Assigned(QueryEdit) and (tfQueryFocused in FDlg.Flags) then
|
if Assigned(QueryEdit) and (tfQueryFocused in FDlg.Flags) then
|
||||||
ActiveControl := QueryEdit;
|
ActiveControl := QueryEdit;
|
||||||
|
|
||||||
|
FExpanded := (tfExpandedByDefault in FDlg.Flags);
|
||||||
finally
|
finally
|
||||||
EnableAutoSizing;
|
EnableAutoSizing;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user