From 50e05800f41232d5be4e0ed75146915afaa6f5e2 Mon Sep 17 00:00:00 2001 From: JeffR Date: Sat, 6 Sep 2025 19:28:14 -0500 Subject: [PATCH] Fixes issues with shifting the gui selection dropdown to be searchable via the Ex control. --- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 32 +++++++++++++------ .../game/tools/guiEditor/gui/guiEditor.ed.gui | 2 +- .../scripts/guiEditorContentList.ed.tscript | 8 +++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 82c61b7cf..c34518274 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -1317,21 +1317,35 @@ void GuiPopUpMenuCtrlEx::closePopUp() return; // Get the selection from the text list: - mSelIndex = mTl->getSelectedCell().y; + if (mSearchText.isEmpty()) + { + mSelIndex = mTl->getSelectedCell().y; + } + else + { + S32 filteredEntryCount = 0; + for (U32 i=0; i < mEntries.size(); i++) + { + String entryText = String::ToLower(mEntries[i].buf); + if (entryText.find(mSearchText) != -1 && mEntries[i].id != -2) + { + if (filteredEntryCount == mTl->getSelectedCell().y) + { + mSelIndex = i; + break; + } + + filteredEntryCount++; + } + } + } mSelIndex = ( mRevNum >= mSelIndex && mSelIndex != -1 ) ? mRevNum - mSelIndex : mSelIndex; if ( mSelIndex != -1 ) { if (mReplaceText) setText(mEntries[mSelIndex].buf); - for(U32 i=0; i < mEntries.size(); i++) - { - if(dStrcmp(mEntries[i].buf,mTl->mList[mSelIndex].text) == 0) - { - setIntVariable(mEntries[i].id); - break; - } - } + setIntVariable(mEntries[mSelIndex].id); } // Release the mouse: diff --git a/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui b/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui index 96e6422b4..301d1e689 100644 --- a/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui +++ b/Templates/BaseGame/game/tools/guiEditor/gui/guiEditor.ed.gui @@ -291,7 +291,7 @@ $guiContent = new GuiControl(GuiEditorGui, EditorGuiGroup) { horizSizing = "right"; vertSizing = "center"; position = "8 0"; - extent = "300 27"; + extent = "300 20"; minExtent = "8 2"; canSave = "1"; visible = "1"; diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorContentList.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorContentList.ed.tscript index ec13d301f..fd5fc0c9a 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorContentList.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorContentList.ed.tscript @@ -96,7 +96,11 @@ function GuiEditorContentList::scanGroup( %this, %group ) //--------------------------------------------------------------------------------------------- -function GuiEditorContentList::onSelect( %this, %ctrl ) +function GuiEditorContentList::onSelect( %this, %index, %text ) { - GuiEditor.openForEditing( %ctrl ); + //Strip out just the guiControl id + %ctrlId = getToken(%text, "-", 1); + %ctrlId = trim(%ctrlId); + + GuiEditor.openForEditing( %ctrlId ); }