Community
    • Login

    Change the font color of status bar message on "Find" dialog

    Scheduled Pinned Locked Moved General Discussion
    messagescolorizationwin32
    3 Posts 2 Posters 363 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Budi KusasiB
      Budi Kusasi
      last edited by

      I can hardly figure out how to change the status bar message/font color of find dialog window.
      All I found was just

      void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus staus) {
      //…
      if (isVisible()) {
      _statusbarFindStatus = staus;
      _statusBar.setOwnerDrawText(msg.c_str());
      }
      //…
      and invocation leads to:

      bool StatusBar::setOwnerDrawText(const TCHAR* str)
      {
      if (str != nullptr)
      _lastSetText = str;
      else
      _lastSetText.clear();

      return (::SendMessage(_hSelf, SB_SETTEXT, SBT_OWNERDRAW, reinterpret_cast<LPARAM>(_lastSetText.c_str())) == TRUE);
      

      }

      and honestly I barely have knowledge in SendMessage() usages, even if this gives good information:

      https://docs.microsoft.com/en-us/windows/win32/winmsg/about-messages-and-message-queues

      How is actually to change the Find dialog status bar message color?
      Any helpful guidance is gratified. Thanks in advance

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @Budi Kusasi
        last edited by

        @Budi-Kusasi

        So the possible existing colors are red, green and blue.

        Searching the Notepad++ codebase for blue quickly yields a hit in FindReplaceDlg.cpp:

        void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
        {
        	//printStr(TEXT("OK"));
        	COLORREF fgColor = RGB(0, 0, 0); // black by default
        	PCTSTR ptStr =(PCTSTR)lpDrawItemStruct->itemData;
        
        	if (_statusbarFindStatus == FSNotFound)
        	{
        		fgColor = RGB(0xFF, 00, 00); // red
        	}
        	else if (_statusbarFindStatus == FSMessage)
        	{
        		fgColor = RGB(0, 0, 0xFF); // blue
        	}
        	else if (_statusbarFindStatus == FSTopReached || _statusbarFindStatus == FSEndReached)
        	{
        		fgColor = RGB(0, 166, 0); // green
        	}
        	else if (_statusbarFindStatus == FSNoMessage)
        	{
        		ptStr = TEXT("");
        	}
        	
        	SetTextColor(lpDrawItemStruct->hDC, fgColor);
        	COLORREF bgColor = getCtrlBgColor(_statusBar.getHSelf());
        	::SetBkColor(lpDrawItemStruct->hDC, bgColor);
        	RECT rect;
        	_statusBar.getClientRect(rect);
        	::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
        }
        

        Not sure, but is that what you’re asking about?

        1 Reply Last reply Reply Quote 1
        • Budi KusasiB
          Budi Kusasi
          last edited by

          SBc.png
          THANKS BILLIONS !
          How had I to be dumb

          1 Reply Last reply Reply Quote 1
          • mkupperM mkupper referenced this topic on
          • First post
            Last post
          The Community of users of the Notepad++ text editor.
          Powered by NodeBB | Contributors