From 7d39a3bc455be1d64f151727fbb6a2a55f9ac8bb Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 24 Feb 2016 17:14:30 +0000 Subject: [PATCH] Added check if there more than SEARCHSETTING_MAX settings, disable minus. --- source/search/frmSearch.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/search/frmSearch.cpp b/source/search/frmSearch.cpp index 56ae1ed..46d7d1e 100644 --- a/source/search/frmSearch.cpp +++ b/source/search/frmSearch.cpp @@ -382,7 +382,7 @@ void frmSearch::SearchFinished( wxCommandEvent& event ){ void frmSearch::DisableAllSearchSettings(bool Enable){ // Check if there is only one search value. If there is, only enable - // the add button. + // the add button if this is the case. if (SearchFrames.size() == 1){ @@ -392,6 +392,22 @@ void frmSearch::DisableAllSearchSettings(bool Enable){ } + // Check if there is SEARCHSETTINGS_MAX controls set or more, only + // enable the remove button if this is the case. + + if (SearchFrames.size() >= SEARCHSETTINGS_MAX){ + + for (std::map::iterator siter = SearchFrames.begin(); + siter != SearchFrames.end(); siter++){ + + XABSearchPanel *XABSPPtr = static_cast(SearchFrames.begin()->second); + XABSPPtr->EnableButtons(FALSE, TRUE); + + } + return; + + } + // More than one control, so process them. for (std::map::iterator siter = SearchFrames.begin(); -- 2.39.5