I am working on cross platform application and implement a drag and drop functionality in code. My implementation is working fine with Linux and Window plateform but on mac platform it do not do anything and return wxDragNone to me.
I am using a control class that derived with wxControl and implement code just like sample :
Set target:
SetDropTarget(new DragnDropText(this)); // in constructor
On Mouse down:
Code: Select all
wxString strText = _("Dummy data"); // only to satisfy virtual function
// start drag operation
wxTextDataObject textData(strText);
wxDropSource* source = new wxDropSource(textData, this);
int flags = 0;
flags |= wxDrag_AllowMove;
wxDragResult result = source->DoDragDrop(flags);
Refresh();
switch ( result )
{
case wxDragCancel: //When user cancle the drag using escape key
{
if(HasCapture())
ReleaseMouse();
}
break;
case : wxDragNone:
wxMessageBox(_("none"))
break
default:
break;
}
}
Code: Select all
bool ueDragnDropText::OnDropText(wxCoord x, wxCoord y, const wxString& text)
{
m_ctrl->SetValue( );
}
result = NSDragOperationToWxDragResult([delegate code]); give me wxDragNone
Sample code for drag and drop is working fine on mac , but in my case my target and source is same control and functionality is just drag text on text editor.
But this is not working on mac machine what wrong i am doing, do't know , please suggest?
I am using wxWidgrts-2.9.2
Yogesh