Correct example of using wxDataObjectComposite in the docs

Don't call base class pure virtual method, but do call GetData() before
using the data object. Also fix a typo in a variable name.
This commit is contained in:
Vadim Zeitlin
2017-11-24 23:10:47 +01:00
parent 778340a286
commit 19c4172671

View File

@@ -427,13 +427,13 @@ public:
wxDragResult MyDropTarget::OnData(wxCoord x, wxCoord y,
wxDragResult defaultDragResult)
{
wxDragResult dragResult = wxDropTarget::OnData(x, y, defaultDragResult);
if ( dragResult == defaultDragResult )
{
if ( !GetData() )
return wxDragNone;
wxDataObjectComposite *
dataobjComp = static_cast<wxDataObjectComposite *>(GetDataObject());
wxDataFormat format = dataObjects->GetReceivedFormat();
wxDataFormat format = dataobjComp->GetReceivedFormat();
wxDataObject *dataobj = dataobjComp->GetObject(format);
switch ( format.GetType() )
{
@@ -458,9 +458,8 @@ public:
default:
wxFAIL_MSG( "unexpected data object format" );
}
}
return dragResult;
return defaultDragResult;
}
@endcode