TVirtualDrawTree.OnSaveNode Event

Virtual Tree View

Streaming support event.

Pascal
property OnSaveNode: TVTSaveNodeEvent;
Description

This event is triggered whenever a certain node must be serialized into a stream, e.g. for saving to file or for copying to another tree/node during a clipboard or drag'n drop operation. Make sure you only store non-transient data into the stream. Pointers (including long/wide string references) are transient and the application cannot assume to find the data a pointer references on saving at the same place when the node is loaded (see also OnLoadNode). This is even more essential for nodes which are moved or copied between different trees in different processes (applications). Storing strings however is easily done by writing the strings as a whole into the stream.

Notes

For exchanging data between different trees and for general stability improvement I strongly recommend that you insert a 

kind of identifier as first stream entry when saving a node. This identifier can then be used to determine what data will 

follow when loading the node later and does normally not required to be stored in the node data.

See Also

OnLoadNode, LoadFromStream, SaveToStream, AddFromStream, VTTreeStreamVersion, TVTHeader.LoadFromStream, TVTHeader.SaveToStream

Class
Links
What do you think about this topic? Send feedback!