lcl: formatting of ShowInputDialog + move Parent := Form to the first place after each sub-control creation (fixes bug #0013310)

git-svn-id: trunk@18955 -
This commit is contained in:
paul 2009-03-11 09:27:40 +00:00
parent cde7240564
commit d2bc2a33cf

View File

@ -24,31 +24,34 @@ var
begin
Result := False;
Form := TForm.CreateNew(nil, 0);
With Form do begin
with Form do
begin
BorderStyle := bsDialog;
Caption := InputCaption;
Prompt := TLabel.Create(Form);
With Prompt do begin
with Prompt do
begin
Parent := Form;
Caption := InputPrompt;
Top := 8;
Left := 8;
Visible := True;
AutoSize := True;
Parent := Form;
end;
Position := poScreenCenter;
Edit := TEdit.Create(Form);
With Edit do begin
with Edit do
begin
Parent := Form;
Left := Prompt.Left;
AnchorToNeighbour(akTop,8,Prompt);
AnchorParallel(akRight,0,Prompt);
AnchorToNeighbour(akTop, 8, Prompt);
AnchorParallel(akRight, 0, Prompt);
MinEditWidth := max(260, Screen.Width div 4);
Constraints.MinWidth := MinEditWidth;
Text := Value;
TabStop := True;
Visible := True;
If MaskInput then
if MaskInput then
begin
EchoMode := emPassword;
PasswordChar:='*';
@ -59,22 +62,25 @@ begin
end;
TabOrder := 0;
end;
With TBitBtn.Create(Form) do begin
with TBitBtn.Create(Form) do
begin
Parent := Form;
Kind := bkOk;
Default := True;
ModalResult := mrOk;
Left := MinEditWidth div 6;
AnchorToNeighbour(akTop,8,Edit);
AnchorToNeighbour(akTop, 8, Edit);
AutoSize := True;
TabStop := True;
Visible := True;
TabOrder := 1;
Parent := Form;
end;
With TBitBtn.Create(Form) do begin
with TBitBtn.Create(Form) do
begin
Parent := Form;
Kind := bkCancel;
Cancel := True;
AnchorToNeighbour(akTop,8,Edit);
AnchorToNeighbour(akTop, 8, Edit);
AnchorSide[akRight].Control := Edit;
AnchorSide[akRight].Side := asrRight;
BorderSpacing.Right := MinEditWidth div 6;
@ -84,7 +90,6 @@ begin
TabStop := True;
Visible := True;
TabOrder := 2;
Parent := Form;
end;
ChildSizing.TopBottomSpacing := 8;
@ -93,7 +98,7 @@ begin
// upon show, the edit control will be focused for editing, because it's
// the first in the tab order
If ShowModal = mrOk then
if ShowModal = mrOk then
begin
Value := Edit.Text;
Result := True;