Skip to content

Can WinDialog be extended to create Notepad++ dockable dialogue? #13

Open

Description

@vinsworldcom

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.

Activity

  1. Ekopalypse commented on Dec 20, 2023

    @Ekopalypse
    Owner

    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.

  2. vinsworldcom commented on Dec 20, 2023

    @vinsworldcom
    Author

    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.

  3. Ekopalypse commented on Dec 20, 2023

    @Ekopalypse
    Owner

    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.

  4. Ekopalypse commented on Dec 20, 2023

    @Ekopalypse
    Owner

    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.

  5. Ekopalypse commented on Dec 27, 2023

    @Ekopalypse
    Owner

    With Rust and CreateDialogIndirectParamW it works, so it looks like it's not a problem with this API function ... hmm ...

    rust_dynamic_dlg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions