- Search string now assumed with * at the ends in object browser
[public/netxms.git] / src / console / win32 / ObjectSearchBox.cpp
index 77fc8d4..8dee766 100644 (file)
@@ -38,6 +38,7 @@ BEGIN_MESSAGE_MAP(CObjectSearchBox, CToolBox)
        ON_WM_CTLCOLOR()
        //}}AFX_MSG_MAP
        ON_COMMAND(ID_FIND_OBJECT, OnFindObject)
+   ON_MESSAGE(WM_EDITBOX_EVENT, OnEditBoxEvent)
 END_MESSAGE_MAP()
 
 
@@ -111,5 +112,21 @@ HBRUSH CObjectSearchBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
 
 void CObjectSearchBox::OnFindObject()
 {
-   MessageBox("FIND");
+   TCHAR szBuffer[256];
+
+   szBuffer[0] = _T('*');
+   m_wndEditBox.GetWindowText(&szBuffer[1], 255);
+   _tcscat(szBuffer, _T("*"));
+   GetParent()->SendMessage(WM_FIND_OBJECT, 0, (LPARAM)szBuffer);
+}
+
+
+//
+// WM_EDITBOX_EVENT message handler
+//
+
+void CObjectSearchBox::OnEditBoxEvent(WPARAM wParam, LPARAM lParam)
+{
+   if ((wParam == IDC_EDIT_SEARCH_STRING) && (lParam == EDITBOX_ENTER_PRESSED))
+      PostMessage(WM_COMMAND, ID_FIND_OBJECT, 0);
 }