unit ObjectMetadataForm;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, TextEditor, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TObjectMetadataFrm = class(TForm)
    Shape1: TShape;
    Label1: TLabel;
    Shape2: TShape;
    Label2: TLabel;
    Label3: TLabel;
    btnOk: TButton;
    btnCancel: TButton;
    teTitle: TTextEditor;
    teDescr: TTextEditor;
  private
    { Private declarations }
  public
    { Public declarations }
  end;

function SetMetadata(AOwnerDialog: TCustomForm; ADrawable: TObject): Boolean;

implementation

uses
  VisCtl2D;

{$R *.dfm}

function SetMetadata(AOwnerDialog: TCustomForm; ADrawable: TObject): Boolean;
begin
  var frm := TObjectMetadataFrm.Create(AOwnerDialog);
  try
    var LDrawable := ADrawable as TDrawable;
    frm.teTitle.PlainText := LDrawable.Title;
    frm.teDescr.PlainText := LDrawable.Description;
    Result := frm.ShowModal = mrOk;
    if Result then
    begin
      LDrawable.Title := frm.teTitle.PlainText;
      LDrawable.Description := frm.teDescr.PlainText;
    end;
  finally
    frm.Free;
  end;
end;

end.
