Einzelnen Beitrag anzeigen

Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.691 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: iOS Comboboxen, ShowMessage Probleme

  Alt 7. Mai 2018, 13:11
Hier ein Beispiel für TPopup Workaround
how-to-make-my-own-dialog-component-from-firemonkey-tpopup
Delphi-Quellcode:
unit PopupTest;

interface

uses
  System.SysUtils, System.Classes, FMX.Types, FMX.Controls,
  FMX.Layouts, FMX.StdCtrls;

type
  TPopupTest = class(TPopup)
  private
    FPanel : TPanel;
    FLayoutButton : TLayout;
    FCloseButton : TButton;
    FSaveButton : TButton;
    FClientArea : TLayout;
  protected
    procedure OnClose(Sender: TObject);
    procedure OnSave(Sender: TObject);
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Samples', [TPopupTest]);
end;

{ TPopupTest }

constructor TPopupTest.Create(AOwner: TComponent);
var
PopPanel: TPanel;
PopLayout: TLayout;
PopClose: TButton;
PopSave: TButton;
PopClientArea: TLayout;
begin
  inherited;

  PopPanel := TPanel.Create(Owner);
  PopPanel.Position.X := 0;
  PopPanel.Position.Y := 0;
  PopPanel.Margins.Left := 10;
  PopPanel.Margins.Right := 10;
  PopPanel.Margins.Top := 10;
  PopPanel.Margins.Bottom := 10;
  PopPanel.StyleLookup := 'flyoutpanel';
  PopPanel.Parent := Owner as TFmxObject;
  PopPanel.Align := TAlignLayout.alClient;
  PopPanel.Visible := True;

  PopLayout := TLayout.Create(Owner);
  PopLayout.Parent := PopPanel;
  PopLayout.Align := TAlignLayout.alBottom;
  PopLayout.Height := 22;

  PopClose := TButton.Create(Owner);
  PopClose.Parent := PopLayout;
  PopClose.Align := TAlignLayout.alLeft;
  PopClose.StyleLookup := 'flyoutbutton';
  PopClose.Text := 'Fechar';
  PopClose.OnClick := OnClose;

  PopSave := TButton.Create(Owner);
  PopSave.Parent := PopLayout;
  PopSave.Align := TAlignLayout.alLeft;
  PopSave.StyleLookup := 'flyoutbutton';
  PopSave.Text := 'Salvar';
  PopSave.OnClick := OnSave;

  PopClientArea := TLayout.Create(Owner);
  PopClientArea.Parent := PopPanel;
  PopClientArea.Align := TAlignLayout.alClient;

  FPanel:= PopPanel;
  FLayoutButton:= PopLayout;
  FSaveButton:= PopSave;
  FCloseButton:= PopClose;
  FClientArea:= PopClientArea;

  Width := 100;
  Height := 100;
end;

destructor TPopupTest.Destroy;
begin
  FClientArea.Free;
  FCloseButton.Free;
  FSaveButton.Free;
  FLayoutButton.Free;
  FPanel.Free;

  inherited;
end;

procedure TPopupTest.OnClose(Sender: TObject);
begin

end;

procedure TPopupTest.OnSave(Sender: TObject);
begin

end;

end.
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat