User forums > General (but related to Code::Blocks)
File explorer window
dmoore:
PS: I'll also take a look at your codesnippets code...
dmoore:
here's the class spec (all public to keep things simple):
--- Code: ---class FileTreeCtrl: public wxTreeCtrl
{
public: //wxTR_HIDE_ROOT|/*wxTAB_TRAVERSAL|*//*|wxTR_HAS_BUTTONS*//*wxTR_MULTIPLE|*/
FileTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxTR_DEFAULT_STYLE|wxTR_NO_LINES,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = _T("treeCtrl"));
FileTreeCtrl();
FileTreeCtrl(wxWindow *parent);
virtual ~FileTreeCtrl();
void DoSortChildren(const wxTreeItemId& ti);
int OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2);
DECLARE_DYNAMIC_CLASS(FileTreeCtrl)
DECLARE_EVENT_TABLE()
};
--- End code ---
I've tried calling sortchildren from its owner or calling dosortchildren, which calls the wxTreeCtrl::SortChildren to no avail...
Pecan:
I did a svn checkout of cbilplugin.
I compiled it with MSW wxWidgets-2.8.4 (had to cast two ints and add #include <wx/notebook.h> to define wxNB_TOP).
I added traps at:
--- Code: --- asm("int3");
m_Tree->SortChildren(ti);
return true;
--- End code ---
and
--- Code: ---int FileTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2)
{
asm("int3");
if(GetItemImage(item1)>GetItemImage(item2))
return -1;
if(GetItemImage(item1)<GetItemImage(item2))
return 1;
return (GetItemText(item1).Cmp(GetItemText(item2)));
}
--- End code ---
and then ran CB under gdb.
Both traps occurred, and the second trap got a bazillion hits as the plugin initalized. So your code is being called just fine.
You just have to code the sort correctly.
See ArtoJ's code in CodeSnippets. CodeSnippetsTreeCtrl::OnCompareItems.
dmoore:
thanks pecan!! I have been using wx2.6.3, but I doubt that is the problem. more likely the getitemimage calls are invalid under win32?
dmoore:
nope I was wrong -- wx2.6.3 was the problem. the sort with 2.8.4 works fine. 8) (and a pox on those wx guys :lol:)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version