It's because of wxFlatNotebook. It makes its notebooks accept drag'n'drop, effectively killing our drag'n'drop implementation...
February 18, 2006 8:21 AM
The code gnomes are yet bent-in-half laughing at me…
My idea to use mouse events to implement SetDropTarget() will not work when the drop source originates outside of the CB main frame because the operating system hides the mouse interrupts (events) until after the mouse key is lifted.
But (there’s always a big butt…) that doesn’t stop us from fixing the problem.
While inserting my favorite asm(“int3”) in the wxFNB code I realized that, at least for CB, wxFNB is not using its “wxFlatNotebook::DropTarget”; its using a “wxPageContainer::DropTarget” to drag tabs around.
So the simplest solution is to steal back the “main::DropTarget” after instantiating wxFlatNnotebooks. So at main.cpp line 549 insert the following:
// wxFlatNotebooks are allocated by the Manager::Get() calls above. //pecan 2/18/2006
// wxFlatNotebooks isn't using the wxFlatNnotebook drop target for //pecan 2/18/2006
// CodeBlocks even though it sets them. It uses the wxPageContainer //pecan 2/18/2006
// drop target to drag tabs around. So here we steal back our Drag'n'Drop //pecan 2/18/2006
// targets in order to drop files into the project and files manager. //pecan 2/18/2006
m_pEdMan->GetNotebook()->SetDropTarget(new wxMyFileDropTarget(this)); //pecan 2/18/2006
m_pPrjMan->GetNotebook()->SetDropTarget(new wxMyFileDropTarget(this)); //pecan 2/18/2006
m_pMsgMan->GetNotebook()->SetDropTarget(new wxMyFileDropTarget(this)); //pecan 2/18/2006
patch has been submitted
thanks
pecan
from: mandrav on February 16, 2006, 11:53:51 AM
It's because of wxFlatNotebook. It makes its notebooks accept drag'n'drop, effectively killing our drag'n'drop implementation...
I believe I've gotten to the bottom of the "wxFNB stole the drop target" problem.
The wxFNB constructor is issuing SetDropTarget(...) implicitly using its parents' window. It should be issuing "this->SetDropTarget(...)".
But... can it use "this->" in its constructor?
If not, it should issue SetDropTarget(this) outside of its constructor to avoid the theft.
This also means wxFNB's wxPageContainer:: is issuing SetDropTarget() on wxFlatNotebook instead of itself.
wxFlatNotebook::wxFlatNotebook(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
{
...code removed for brevity...
m_pDropTarget = new wxFNBDropTarget<wxFlatNotebook>(this, &wxFlatNotebook::OnDropTarget);
SetDropTarget(m_pDropTarget);
}
thanks
pecan