Can WinDialog be extended to create Notepad++ dockable dialogue?
Obviously cannot from ctypes import NotepadPlusPlus.DockingDlgInterface, but wondering if you can create the tTbData structure:
https://github.com/npp-plugins/plugintemplate/blob/fd051e4cadaa2adcbedfdc27a817bc72eb0ae174/src/DockingFeature/Docking.h#L49-L63
and then register it:
SendMessage(notepad.hwnd, NPPM_DMMREGASDCKDLG, 0, (LPARAM)&data);
If you could pull it off? That would be a huge win allowing PythonScript to essentially be a full-fledged Notepad++ plugin creator scripting language.
Cheers.
Hi, in general, yes, but I have an issue whose cause I have not yet found. Another problem(?) is how such a dialog would be handled after a restart of Npp. I hope to find some time over the Christmas holidays to look into this in more detail.
I see. I was going to play around with it, but it seems your 'WinDialog_tests_\test_npp_downloader.py' script is different than the one I have in my clone of the repo.
Cheers.
Ah, yes - the dockable dialog feature hasn't been made public yet. I'll publish another branch with this experiment after work (3-4h) today.
See https://github.com/Ekopalypse/NppPythonScripts/tree/dockable_dialog_experiment
from Npp import console
from WinDialog import DockableDialog, Button
class MyDialog(DockableDialog):
def __init__(self, title='Dockable Dialog Test'):
super().__init__(title=title)
self.pointsize = 11
self.typeface = 'Segoe UI'
self.btn1 = Button('Button1', (40, 11), (0, 0))
self.btn2 = Button('Button2', (40, 11), (40, 0))
self.btn1.onClick = self.on_click1
self.btn2.onClick = self.on_click2
def on_click1(self):
print("button 1 pressed")
def on_click2(self):
print("button 2 pressed")
console.show()
dlg = MyDialog()
dlg.show()
Just to be clear: I haven't really tested it, but I haven't had any major problems with it.
With Rust and CreateDialogIndirectParamW it works, so it looks like it's not a problem with this API function ... hmm ...