Working with Scintilla / Create a dock dilog like "Search Results"

  • Ami Friedman

    Ami Friedman - 2013-05-16

    As part of my plugin I would like to create a dock-able window on the bottom with some text in it. Very similar to the "Search Results" window. I've been trying for DAYS to no avail :(
    I'm able to create the dock-able window but for the life of me I cannot get my text to display.

    Here's what I did so far:

    myObj.create(&data); //myObj is an instance of a class inherited from the DockingDlgInterface class

    // define the default docking behaviour
    data.uMask = DWS_DF_CONT_BOTTOM;

    data.pszModuleName = g_DsplyBkmrksObj.getPluginFileName();

    // the dlgDlg should be the index of funcItem where the current function pointer is
    ::SendMessage(g_notpadPlusData._nppHandle, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data);

    This part works and the dialog appears.

    Here's the point that doesn't work (this is within myObj.display()):

    HWND newScintillaHandle = (HWND)::SendMessage(_hParent,NPPM_CREATESCINTILLAHANDLE,0,NULL);
    ::SendMessage(newScintillaHandle, SCI_SETTEXT, 0, (LPARAM)"Hello World!");

    From what I can see there is a minimum configuration I need to do in order to be able to write/display text in my scintilla. Is that correct? Any idea what these minimum configurations need to be? The code from the "Search Results" was getting to complicated for me to follow :(

  • Ami Friedman

    Ami Friedman - 2013-05-16

    Well looks like I was missing:

    Now it looks like the scintilla is shown and I can control it.However the actual scintilla window (the edit window) is very narrow and short. I could not figure out how to contorl the width and height of the edit view window.
    See in attached image on the bottom right.

    Anyone have an idea?

  • DV

    DV - 2013-05-16

    if (uMessage == WM_SIZE)
    RECT rect;
    ::GetClientRect(hDlg, &rect);
    ::MoveWindow(hScintilla, rect.left+2,, rect.right-4, rect.bottom-4, TRUE);

  • Ami Friedman

    Ami Friedman - 2013-05-16

    Thanks DV. This is EXACTLY what I ended up doing :)

    Now to my next issue:
    If the user closes my dialog window with the X button - how can I be aware of it in my plugin? Which WM would that be? And will it be even sent to my plugin? Since I get the WM_SIZE of the parent (the dock window) I'm guessing I should be getting this one too. I tried WM_CLOSE but didn't work. I tried in debug mode to see what message I get but they seemed to be irrelevant ones.

  • DV

    DV - 2013-05-17

    Docked dialogs get additional notifications:

    else if (uMessage == WM_NOTIFY)
      NMHDR* pnmh = (NMHDR*) lParam;
      if (pnmh->hwndFrom == m_nppData._nppHandle)
          case DMN_CLOSE: OnClose(); break;
          case DMN_FLOAT: m_isDocked = false; break;
          case DMN_DOCK: m_isDocked = true; break;

    Refer to "Docking.h" and, if needed, inspect Notepad++'s source code for usage of the docked dialogs.

    Last edit: DV 2013-05-17

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks