AddChildObjectFirst (Delphi)
Description
The following example adds a new item to the selected item's list of child items in the tree view control. The new item is added first in the list of child items. The new item is identified by the text 'New Item'. The TBitmap object is attached to the new item.
Code
procedure TForm1.Button1Click(Sender: TObject);
var
MyBitMap : TBitmap;
node : TTreeNode;
begin
MyBitMap := TBitmap.Create;
MyBitMap.LoadFromFile('littleB.bmp');
TreeView1.Items.BeginUpdate;
node:= TreeView1.Items.AddChildObjectFirst(
TreeView1.Selected, 'New Item', MyBitMap);
// node.ImageIndex:= -1;
TreeView1.Items.EndUpdate;
end;
Uses
- Vcl.ComCtrls.TTreeNodes.AddChildObjectFirst ( fr | de | ja )
- Vcl.ComCtrls.TTreeNodes.BeginUpdate ( fr | de | ja )
- Vcl.ComCtrls.TTreeNodes.EndUpdate ( fr | de | ja )