lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master 9ec7d83 2/7: Update item selection of wxItemC


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 9ec7d83 2/7: Update item selection of wxItemContainer only when necessary
Date: Thu, 13 Jun 2019 20:39:00 -0400 (EDT)

branch: master
commit 9ec7d83f525bf3e230897b3ecc8826f133633577
Author: Ilya Sinitsyn <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Update item selection of wxItemContainer only when necessary
    
    wxItemContainer::SetStringSelection function is slower then
    wxItemContainer::GetStringSelection, so update the selected item only
    when the selection was really changed.
---
 mvc_controller.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mvc_controller.cpp b/mvc_controller.cpp
index 60329a8..77eb54b 100644
--- a/mvc_controller.cpp
+++ b/mvc_controller.cpp
@@ -353,7 +353,11 @@ void MvcController::ConditionallyEnableItems
             itembox->Set(cached_items);
             }
 
-        itembox->SetStringSelection(datum->str(datum->ordinal()));
+        auto const& selected_string = datum->str(datum->ordinal());
+        if(itembox->GetStringSelection() != selected_string)
+            {
+            itembox->SetStringSelection(selected_string);
+            }
         }
     else
         {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]