• Login
Community
  • Login

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

Scheduled Pinned Locked Moved General Discussion
messagescolorizationwin32
3 Posts 2 Posters 462 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.
  • B
    Budi Kusasi
    last edited by Feb 10, 2020, 11:51 PM

    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

    A 1 Reply Last reply Feb 10, 2020, 11:59 PM Reply Quote 0
    • A
      Alan Kilborn @Budi Kusasi
      last edited by Feb 10, 2020, 11:59 PM

      @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
      • B
        Budi Kusasi
        last edited by Feb 11, 2020, 2:31 AM

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

        1 Reply Last reply Reply Quote 1
        • M mkupper referenced this topic on Apr 27, 2024, 9:44 PM
        1 out of 3
        • First post
          1/3
          Last post
        The Community of users of the Notepad++ text editor.
        Powered by NodeBB | Contributors