Jump to content

UniPropertyGrid


pro_imaj

Recommended Posts

Merhaba;

 

UniPropertyGrid AttachedComponent özelliğindeki Gride gelen verileri  Dışarıya aktarma ve sonrasında da tam tersi içeriye almayı yapabilir miyiz.

 

Örnek.

Runtime'da bir nesne oluşturduğumuzu varsayalım.

1-AttachedComponent  gelen değerleri kullanıcı düzenledi, kaydet tuşu ile bu verileri herhangi bir formatta dışarı almak.

2-Dışarıya alınan nesnenin son özelliklerini Form Create olurken kayıtlı yerden nesneye tekrar yüklemek.

 

Property : AttachedComponent  / Export/Import

 

Teşekkürler.

 

 

Link to comment
Share on other sites

merhabalar

 

Stream ile componentleri kaydedebilirsiniz.

 

Örneğin kayıt için bir buton ekleyip şuna benzer bir kodla attached componenti save edebilirsiniz

procedure TMainForm.UniSaveButtonClick(Sender: TObject);
var
  Stream: TFileStream;
begin
  Stream := TFileStream.Create(UniServerModule.StartPath+'mycomponent.dat', fmCreate);
  try
    Stream.WriteComponent(UniPropertyGrid1.AttachedComponent);
  finally
    Stream.Free;
  end;
end;

Form oncreate anında da şu kodla çağırabilirsiniz

procedure TMainForm.UniFormCreate(Sender: TObject);
var
  Stream: TFileStream;
begin
  if FileExists(UniServerModule.StartPath+'mycomponent.dat') then
  begin
    Stream := TFileStream.Create(UniServerModule.StartPath+'mycomponent.dat', fmOpenRead);
    try
      Stream.ReadComponent(UniPropertyGrid1.AttachedComponent);
    finally
      Stream.Free;
    end;
  end;
end;
Link to comment
Share on other sites

Merhabalar;

 

Evet UniPropertyGrid'e attach edilen componentin bazı özellikleri property grid'e gelmeyebilir. Bu durumda bu özellikleri başka bir yerde (bir panelde, frame içerisinde, farklı bir formda) tanımlayabilirsiniz.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...