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