Page 1 of 1

Can set "Readonly" in Virtual Table?

Posted: Sat 16 Mar 2013 16:51
by tcflam
Hi, I check Virtual Table hasn't readonly property. But I want to protect the Virtual Table that doesn't allow user to modify any records. Any idea?

Re: Can set "Readonly" in Virtual Table?

Posted: Mon 18 Mar 2013 09:00
by AndreyZ
Hello,

For the time being, TVirtualTable does not have the ReadOnly property. We will investigate the possibility of adding the ReadOnly property to TVirtualTable.
Now, to prevent users from modifying data of TVirtualTable, you can set the ReadOnly property of all fields to True. Here is an example:

Code: Select all

var
  i: integer;
begin
  VirtualTable1.FieldDefs.Add('test', ftString, 10);
  VirtualTable1.FieldDefs.Add('test1', ftString, 10);
  VirtualTable1.Open;
  VirtualTable1.Append;
  VirtualTable1.FieldByName('test').AsString := 'test';
  VirtualTable1.FieldByName('test1').AsString := 'test1';
  VirtualTable1.Post;
  for i := 0 to VirtualTable1.FieldCount - 1 do
    VirtualTable1.Fields[i].ReadOnly := True;
end;