简体   繁体   English

FMX 中的运行时设计?

[英]run-time design in FMX?

There are components that let you edit forms at run-time in VCL.有一些组件可以让您在 VCL 中在运行时编辑表单。

Is run-time editing of forms possible in FMX?在 FMX 中是否可以在运行时编辑表单? (I want the ability to modify forms inside of mobile apps.) (我希望能够修改移动应用程序内的表单。)

To answer your second question first: Yes it is possible to modify FMX forms and its controls at run time.首先回答您的第二个问题:是的,可以在运行时修改 FMX 表单及其控件。 For your second question: AFAIK there are no components that would you help with that task.对于您的第二个问题:AFAIK 没有任何组件可以帮助您完成该任务。 If you want to go and make your own form designer, be aware that the seemingly highly suitable TSelection component is very buggy up until XE7 and still has some flaws in XE 8 - you better make your own.如果您想制作自己的表单设计器,请注意看似非常合适的 TSelection 组件在 XE7 之前非常有问题,并且在 XE 8 中仍然存在一些缺陷 - 您最好自己制作。

Yes, exactly as in VCL, but most object property will be different.是的,就像在 VCL 中一样,但是大多数对象属性会有所不同。 Following sample create new Button on main form.以下示例在主窗体上创建新按钮。

unit ufmMain;

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls;

type
  TfmMain = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    MyButton1: TButton;
  end;

var
  fmMain: TfmMain;

implementation

{$R *.fmx}

procedure TfmMain.FormCreate(Sender: TObject);
begin
  MyButton1 := TButton.Create(fmMain);
  MyButton1.Parent := fmMain;
  MyButton1.Position.X := 10;
  MyButton1.Position.Y := 10;
  MyButton1.Width := 50;
  MyButton1.Height := 10;
  MyButton1.Text := 'TEXT';
end;

end.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM