From: Stefan Csomor Date: Sat, 15 Feb 2003 08:36:30 +0000 (+0000) Subject: Files from a Drop were only added but the fileslist never cleard X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/e56aba8dd5d3ede5fccf62ad3693fa76a44c9ccb Files from a Drop were only added but the fileslist never cleard git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/dnd.cpp b/src/mac/carbon/dnd.cpp index 09a2f1d373..4033d33e01 100644 --- a/src/mac/carbon/dnd.cpp +++ b/src/mac/carbon/dnd.cpp @@ -173,6 +173,7 @@ bool wxDropTarget::GetData() { UInt16 items ; OSErr result; + bool firstFileAdded = false ; CountDragItems((DragReference)m_currentDrag, &items); for (UInt16 index = 1; index <= items; ++index) { @@ -215,7 +216,13 @@ bool wxDropTarget::GetData() { HFSFlavor* theFile = (HFSFlavor*) theData ; wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ; - ((wxFileDataObject*)m_dataObject)->AddFile( name ) ; + if ( firstFileAdded ) + ((wxFileDataObject*)m_dataObject)->AddFile( name ) ; + else + { + ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ; + firstFileAdded = true ; + } } else { diff --git a/src/mac/dnd.cpp b/src/mac/dnd.cpp index 09a2f1d373..4033d33e01 100644 --- a/src/mac/dnd.cpp +++ b/src/mac/dnd.cpp @@ -173,6 +173,7 @@ bool wxDropTarget::GetData() { UInt16 items ; OSErr result; + bool firstFileAdded = false ; CountDragItems((DragReference)m_currentDrag, &items); for (UInt16 index = 1; index <= items; ++index) { @@ -215,7 +216,13 @@ bool wxDropTarget::GetData() { HFSFlavor* theFile = (HFSFlavor*) theData ; wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ; - ((wxFileDataObject*)m_dataObject)->AddFile( name ) ; + if ( firstFileAdded ) + ((wxFileDataObject*)m_dataObject)->AddFile( name ) ; + else + { + ((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ; + firstFileAdded = true ; + } } else {