Results 1 to 7 of 7

Thread: Glscene & TreeView

  1. #1

    Glscene & TreeView

    Hi ..

    How can I copy all the objects names in the Glscene to the Treeview Component at the same order

    Tank you very much

  2. #2

    Glscene & TreeView

    Here's the code I used (you'll probably have to add GLCrossPlatform to the uses):
    [pascal]
    procedure TForm1.FormCreate(Sender: TObject);

    { .: AddNodes :. }
    function AddNodes(ANode: TTreeNode; AObject: TGLBaseSceneObject): TTreeNode;
    var
    I: Integer;
    CurrentNode: TTreeNode;
    begin
    if IsSubComponent(AObject) then
    begin
    Result := TreeView1.Selected;
    exit;
    end else
    begin
    Result := TreeView1.Items.AddChildObject(ANode, AObject.Name, AObject);
    CurrentNode := Result;
    for I := 0 to AObject.Count -1 do
    Result := AddNodes(CurrentNode, AObject[I]);
    end;
    end;

    var
    I: Integer;
    CameraNode, ObjectNode: TTreeNode;
    begin
    // -- add two root nodes --
    ObjectNode := TreeView1.Items.AddFirst(nil, 'Scene objects');
    CameraNode := TreeView1.Items.AddFirst(nil, 'Cameras');

    // -- get the object's tree --
    TreeView1.Items.BeginUpdate();
    with GLScene1 do
    begin
    // -- cameras --
    if Assigned(Cameras) then
    begin
    CameraNode.Data := Cameras;
    for I := 0 to Cameras.Count -1 do
    AddNodes(CameraNode, Cameras[I]);
    CameraNode.Expand(True);
    end;

    // -- objects (with children too) --
    if Assigned(Objects) then
    begin
    ObjectNode.Data := Objects;
    with Objects do
    for I := 0 to Count -1 do
    AddNodes(ObjectNode, Children[I]);
    ObjectNode.Expand(True);
    end;
    end;
    TreeView1.Items.EndUpdate();
    end;
    [/pascal]

  3. #3

    Glscene & TreeView

    Thank you ..

    But it gave me wrong on " IsSubComponent(AObject) " what can I do

  4. #4

    Glscene & TreeView

    Just like I said here :
    Quote Originally Posted by Brainer
    Here's the code I used (you'll probably have to add GLCrossPlatform to the uses):

  5. #5

    Glscene & TreeView

    I added GLCrossPlatform to the uses but it didn't work ( the same error)

  6. #6

    Glscene & TreeView

    Then search for that one inside your source files, I guess it could have been moved in the latest versions, or download the latest version from the CVS.

  7. #7

    Glscene & TreeView

    Finally it work , Thank you very much

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •