Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

Management Window Drag & Drop

<< < (3/4) > >>

thomas:
2032

Pecan:

--- Quote --- 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...

--- End quote ---

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.


--- Code: ---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);
}

--- End code ---

thanks
pecan

thomas:
SetDropTarget(this) is allowed, because SetDropTarget takes a wxEvtHandler, and wxEvtHandler has already been initialised before wxFlatNotebook::wxFlatNotebook executes.

Pecan:

--- Quote from: thomas on February 28, 2006, 01:37:35 am ---SetDropTarget(this) is allowed, because SetDropTarget takes a wxEvtHandler, and wxEvtHandler has already been initialised before wxFlatNotebook::wxFlatNotebook executes.

--- End quote ---
I don't understand.

SetDropTarget() takes a wxDropTarget as an
argument and is issued via a wxWindow->SetDropTarget(...)

My question was about the constructor using its own "this" pointer:
i.e., is "this" pointer actually initialized in the constructor?
 
Will "this->SetDropTarget(wxDropTarget..)" be allowed in the
wxFlatNotebook constructor which _is_ ,in fact, executing at the point
that the SetDropTarget() is issued.

thanks
pecan

thomas:
this->AnyDataOrMemberOfBaseClass     good
this->AnyDataOrMemberOfCurrentClass  good
this->AnyVirtualMemberOfCurrentClass evil
this->AnythingDerived                evil

SetDropTarget is a member of a base class.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version