]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow calling wxGenericDirCtrl::GetPath() in multiple selection mode, fixes #12340...
authorRobert Roebling <robert@roebling.de>
Sat, 21 Aug 2010 10:17:13 +0000 (10:17 +0000)
committerRobert Roebling <robert@roebling.de>
Sat, 21 Aug 2010 10:17:13 +0000 (10:17 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65375 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/dirctrlg.cpp

index 46b72cf08a1b86b096affc7d900e575ed47bcbc1..eb633d9568268a592b13797c97ea5ee20ae708da 100644 (file)
@@ -1095,6 +1095,22 @@ bool wxGenericDirCtrl::CollapsePath(const wxString& path)
 
 wxString wxGenericDirCtrl::GetPath() const
 {
+    // Allow calling GetPath() in multiple selection from OnSelFilter
+    if (m_treeCtrl->HasFlag(wxTR_MULTIPLE))
+    {
+        wxArrayTreeItemIds items;
+        m_treeCtrl->GetSelections(items);
+        if (items.size() > 0)
+        {
+            // return first string only
+            wxTreeItemId id = items[0];
+            wxDirItemData* data = (wxDirItemData*) m_treeCtrl->GetItemData(id);
+            return data->m_path;
+        }
+        
+        return wxEmptyString;
+    }
+
     wxTreeItemId id = m_treeCtrl->GetSelection();
     if (id)
     {