changeset 4029:86fbc0cb59f2

Readd 'String not found' status message for chat content search
author eMTee <emtee11@gmail.com>
date Tue, 03 Jun 2025 12:39:42 +0200
parents 57d4463f78cd
children 365a0f9e4ed6
files dwt/include/dwt/widgets/RichTextBox.h dwt/src/widgets/RichTextBox.cpp win32/AspectChat.h
diffstat 3 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/include/dwt/widgets/RichTextBox.h	Sat May 31 14:12:22 2025 +0200
+++ b/dwt/include/dwt/widgets/RichTextBox.h	Tue Jun 03 12:39:42 2025 +0200
@@ -134,6 +134,11 @@
 
 	virtual bool handleMessage(const MSG& msg, LRESULT& retVal);
 
+	typedef std::function<void(const tstring&)> Callback;
+ 
+	/// Search string was not found
+	void onSearchStrNotFound(Callback callback) { searchNotFound = callback; } 
+
 	/** Utility structure to surround "scroll-steady" rich text-box operations; when an instance of
 	 * this structure goes out of scope, the scroll position is guaranteed to be kept. */
 	struct HoldScroll  {
@@ -181,6 +186,8 @@
 
 	COLORREF textColor;
 	COLORREF bgColor;
+
+	Callback searchNotFound;
 };
 
 // end namespace dwt
--- a/dwt/src/widgets/RichTextBox.cpp	Sat May 31 14:12:22 2025 +0200
+++ b/dwt/src/widgets/RichTextBox.cpp	Tue Jun 03 12:39:42 2025 +0200
@@ -344,9 +344,9 @@
 		setFocus();
 		sendMessage(EM_EXSETSEL, 0, reinterpret_cast< LPARAM >(&ft.chrg));
 	} else {
-#ifdef PORT_ME
-		addStatus(T_("String not found: ") + needle);
-#endif
+		if (searchNotFound) {
+			searchNotFound(needle);
+		}
 		clearCurrentNeedle();
 	}
 }
--- a/win32/AspectChat.h	Sat May 31 14:12:22 2025 +0200
+++ b/win32/AspectChat.h	Tue Jun 03 12:39:42 2025 +0200
@@ -53,6 +53,7 @@
 			cs.style |= ES_READONLY;
 			chat = dwt::WidgetCreator<RichTextBox>::create(parent, cs);
 			chat->setTextLimit(1024*64*2);
+			chat->onSearchStrNotFound([this](const tstring& text) { t().addStatus(T_("String not found : ") + text); });
 		}
 
 		{