TaskDialog: TLCLTaskDialog: right align (Simple)Query with CommandLinkButtons (if these are present).

This commit is contained in:
Bart 2023-08-08 23:22:56 +02:00
parent d1ac727ad0
commit 4a98bd92be

View File

@ -26,6 +26,7 @@ type
FDlg: TTaskDialog; FDlg: TTaskDialog;
FVerifyChecked: Boolean; FVerifyChecked: Boolean;
FExpanded: Boolean; FExpanded: Boolean;
FCommandLinkButtonWidth: Integer;
Timer: TTimer; Timer: TTimer;
TimerStartTime: TTime; TimerStartTime: TTime;
RadioButtonArray: array of TRadioButton; RadioButtonArray: array of TRadioButton;
@ -248,6 +249,7 @@ begin
inherited CreateNew(AOwner, Num); inherited CreateNew(AOwner, Num);
RadioButtonArray := nil; RadioButtonArray := nil;
FExpanded := False; FExpanded := False;
FCommandLinkButtonWidth := -1;
KeyPreview := True; KeyPreview := True;
DoDialogCreated; DoDialogCreated;
end; end;
@ -403,8 +405,10 @@ begin
Parent := AParent; Parent := AParent;
Font.Height := AFontHeight-3; Font.Height := AFontHeight-3;
if (tfEmulateClassicStyle in FDlg.Flags) then if (tfEmulateClassicStyle in FDlg.Flags) then
SetBounds(X,Y,aWidth-10-X,40) else FCommandLinkButtonWidth := aWidth-10-X
SetBounds(X,Y,aWidth-16-X,40); else
FCommandLinkButtonWidth := aWidth-16-X;
SetBounds(X,Y,FCommandLinkButtonWidth,40);
Caption := FDlg.Buttons[i].Caption; Caption := FDlg.Buttons[i].Caption;
Hint := FDlg.Buttons[i].CommandLinkHint; Hint := FDlg.Buttons[i].CommandLinkHint;
if (Hint <> '') then if (Hint <> '') then
@ -660,7 +664,10 @@ begin
with QueryCombo do with QueryCombo do
begin begin
Items.Assign(FDlg.QueryChoices); Items.Assign(FDlg.QueryChoices);
SetBounds(X,Y,aWidth-32-X,22); if (FCommandLinkButtonWidth > 0) then
SetBounds(X,Y,FCommandLinkButtonWidth,22) //right align with the buttons
else
SetBounds(X,Y,aWidth-32-X,22);
if (tfQueryFixedChoices in FDlg.Flags) then if (tfQueryFixedChoices in FDlg.Flags) then
Style := csDropDownList Style := csDropDownList
else else
@ -684,6 +691,9 @@ begin
QueryEdit := TEdit.Create(Self); QueryEdit := TEdit.Create(Self);
with QueryEdit do with QueryEdit do
begin begin
if (FCommandLinkButtonWidth > 0) then
SetBounds(X,Y,FCommandLinkButtonWidth,22) //right align with the buttons
else
SetBounds(X,Y,aWidth-16-X,22); SetBounds(X,Y,aWidth-16-X,22);
Text := FDlg.SimpleQuery; Text := FDlg.SimpleQuery;
PasswordChar := FDlg.SimpleQueryPasswordChar; PasswordChar := FDlg.SimpleQueryPasswordChar;