Can set "Readonly" in Virtual Table?
Can set "Readonly" in Virtual Table?
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?
			
									
									
						- 
				AndreyZ
 
Re: Can set "Readonly" in Virtual Table?
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:
			
									
									
						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;