Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Plugins development => Topic started by: dushara on November 28, 2010, 12:55:38 pm

Title: Howto work out files/directories within a directory item
Post by: dushara on November 28, 2010, 12:55:38 pm
Hi all,

I need to work out all the files and directories within a directory item that's selected. That is, the current selected item in the project tree is of type FileTreeData::ftdkFolder and I need to find all the files and sub directories. Is there a method that allows me to do this or do I need to work it out myself?

I'm not even sure how to work out the index of the selected item so that I can iterate from that point onwards.

Thanks
Dushara
Title: Re: Howto work out files/directories within a directory item
Post by: oBFusCATed on November 28, 2010, 02:50:49 pm
Have you tried to get the project tree control wxTreeCtrl* ProjectManager::GetTree(){ return m_pTree; }
and then to iterate it?
Title: Re: Howto work out files/directories within a directory item
Post by: dushara on November 29, 2010, 10:25:44 am
Have you tried to get the project tree control wxTreeCtrl* ProjectManager::GetTree(){ return m_pTree; }
and then to iterate it?

Thanks for the reply.

I just had a look at it and it looks like I need to use GetFirstChild and GetNextChild. I'm using Wx-2.8 which marks these functions as deprecated.

    wxDEPRECATED( wxTreeItemId GetFirstChild(const wxTreeItemId& item,
                                             long& cookie) const );
    wxDEPRECATED( wxTreeItemId GetNextChild(const wxTreeItemId& item,
                                            long& cookie) const );


I guess in the absence of anything else, I have to use these am I right? Or have I missed something obvious?

Thanks.
D