Hi dear Sergey,
I want to save tables in global variable to use them any time after creation.
How do that!?
my tables contains controls such as TCheckBoxes and TGraphics in cells.
Thanks a lot.
Use TRVTableItemInfo variable as Global
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 75
- Joined: Fri Jan 06, 2012 8:13 pm
It's impossible save table in global variable absolutely.
when define a global variable as TRVTableItemInfo and create it:
when define a global variable as TRVTableItemInfo and create it:
Code: Select all
table : TRVTableItemInfo;
implementation
procedure CreateTable(table : TRVTableItemInfo);
begin
table := TRVTableItemInfo.CreateEx(100,4, RVe.RVData);
...
RVe.AddItem('',table);
RVe.format;
end;
procedure A;
begin
RVe2.AddItem('',table);
RVe2.format;
end;
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
-
- Posts: 75
- Joined: Fri Jan 06, 2012 8:13 pm
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
If the both tables are inserted in TRichView linked to the same RVStyle, you can use oldtable.SaveToStream(MemoryStream) and newtable.LoadFromStream(MemoryStream) methods.
Otherwise I suggest to copy it by selecting:
Otherwise I suggest to copy it by selecting:
Code: Select all
Stream := TMemoryStream.Create;
RV1.SetSelectionBounds(oldtable.GetMyItemNo, 0, oldtable.GetMyItemNo, 1);
RV1.SaveRVFToStream(Stream, True); // saving selected table to a stream
Stream.Position := 0;
RV2.InsertRVFFromStream(Stream, RV2.ItemCount); // adding the stream content to the end of RV2
newtable := RV2.GetItem(RV2.ItemCount-1) as TRVTableItemInfo;
RV2.Format;
Stream.Free;
-
- Posts: 75
- Joined: Fri Jan 06, 2012 8:13 pm
-
- Site Admin
- Posts: 17564
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: