segunda-feira, 16 de julho de 2007

wxGenericDirCtrl events

I got stumped when trying to catch the file selected with the generic directory tree: there are no events in that control! After some googling I understood: the "selection" event is fired by the tree control, not by the window / control that contains it; if ID_DIR_CTRL is the generic control ID this does not work:
BEGIN_EVENT_TABLE(MyFrame,wxFrame)
EVT_TREE_SEL_CHANGED(ID_DIR_CTRL, MyFrame::OnTreeSelChanged)
END_EVENT_TABLE()

One solid solution was pointed by Joseph Blough using a dynamic connection, that is an (more object like) alternative to event tables. I'll check that on a sunnyless Sunday, for now I stick with the old event table setting the wxTreeCtrl ID:
dirCtrl->GetTreeCtrl()->SetId(ID_TREE_CTRL);
Documentation says that the identifier should not be modified but, hey, I'm setting it in the constructor. And it works!


Update terça-feira, 17 de Julho de 2007:

No, it does not work. Events are catched, but are also lost by the generic directory tree. Sunnyles Sunday on Tuesday, that is. I could get all tree events with wxID_ANY but I'm seeing some more trees coming...

Etiquetas:

0 Comentários:

Enviar um comentário

Subscrever Enviar feedback [Atom]

<< Página inicial