I have a class derived from wxWindow. I can DragAcceptFiles() easily enough, but it doesn't seem to allow me any way to discriminate before the file is dropped.
My grasp of inheritance, and in fact OOP in general, can be a little shaky. I've tried inherting from both wxWindow and wxFileDropTarget, which has an OnEnter() member for when a dragged file enters it, but my override of it, and wxFileDropTarget's OnDropFiles(), doesn't seem to get called.
avsPanel.h:
Code: Select all
class avsPanel : public wxWindow, public wxFileDropTarget {
public:
avsPanel(wxWindow* parent);
void set_other_panel(avsPanel* a);
wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult defResult);
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& st);
private:
...
Code: Select all
avsPanel::avsPanel(wxWindow* parent) : wxWindow(parent, wxID_ANY), wxFileDropTarget() {
this->DragAcceptFiles(true);
}
#define SB ((wxFrame*)this->GetParent())->GetStatusBar()
wxDragResult avsPanel::OnEnter(wxCoord x, wxCoord y, wxDragResult defResult) {
SB->SetStatusText("OnEnter", 0); // this code changes the status bar text of the main frame (definitely works)
return defResult;
}
bool avsPanel::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& st) {
SB->SetStatusText("OnDropFiles", 0); // this code changes the status bar text of the main frame (definitely works)
return false;
}