Einzelnen Beitrag anzeigen

Benutzerbild von NoGAD
NoGAD

Registriert seit: 31. Jan 2006
Ort: Weimar
327 Beiträge
 
Delphi 10.4 Sydney
 
#5

AW: Inputquery mit TDatePicker

  Alt 28. Apr 2021, 00:30
Huhu und Danke für den Code.

Nun habe ich noch ein Label und ein Edit hinzugefügt, beide auf alTop gesetzt.
Wie kann ich die Ausrichtung verändern, dass lbl1 über dem Edit und lbl2 über dem TDatePicker angeordnet sind?


Delphi-Quellcode:
var
  dlg: TForm;
  dp: TDatePicker;
  lbl1: TLabel;
  lbl2: TLabel;
  edt: TEdit;
  btn: TBitBtn;
  date: TDate;
  checker: Boolean;
begin
  dlg := TForm.Create(Application.MainForm);
  try
    dlg.BorderStyle := bsDialog;
    dlg.Caption := _Form_AddBorrow;
    dlg.FormStyle := fsStayOnTop;
    dlg.Position := poOwnerFormCenter;
    dlg.BorderIcons := [biSystemMenu];
    lbl1 := TLabel.Create(dlg);
    lbl1.Parent := dlg;
    lbl1.Align := alTop;
    lbl1.Alignment := taCenter;
    lbl1.AlignWithMargins := True;
    lbl1.Caption := 'Name';
    edt := TEdit.Create(dlg);
    edt.Parent := dlg;
    edt.Align := alTop;
    edt.AlignWithMargins :=true;
    lbl2 := TLabel.Create(dlg);
    lbl2.Parent := dlg;
    lbl2.Align := alTop;
    lbl2.Alignment := taCenter;
    lbl2.AlignWithMargins := True;
    lbl2.Caption := 'Choose Date';
    dp := TDatePicker.Create(dlg);
    dp.Parent := dlg;
    dp.Align := alTop;
    dp.AlignWithMargins := True;
    btn := TBitBtn.Create(dlg);
    btn.Parent := dlg;
    btn.Align := alTop;
    btn.Caption := _Button_AddBorrowOK;
    btn.ModalResult := MrOk;
    btn.Kind := bkOK;
    btn.AlignWithMargins := True;
    dlg.AutoSize := True;
    checker := (btn.ModalResult = dlg.ShowModal);
    date := dp.date;
  finally
    btn.Free;
    dp.Free;
    lbl1.Free;
    edt.Free;
    lbl2.Free;
    dlg.Free;
  end;
LG
Mathias
Ich vergesse einfach zu viel.
  Mit Zitat antworten Zitat