Repeated notepad.messageBox() and notepad.prompt() window appearances should be in the same position
I have a script where I repeatedly call notepad.messageBox(). After the user closes the first message box, I do something in code, then fire another message box. Unfortunately, the "do something in code" that I do is to center some selected-text in the middle of the maximized Notepad++ window. When the second message box appears, it obscures the centered, selected-text. Same for third, fourth, etc. message boxes in my script application.
If I move the first message box to a convenient place on the screen, e.g. a second monitor, then if the future message boxes would appear at that same location, that would be ideal.
Here's a demo script that illustrates:
# -*- coding: utf-8 -*-
from Npp import notepad, MESSAGEBOXFLAGS
notepad.messageBox('Move me so that I am positioned somewhere different than where I appeared\r\n\r\nPress OK', '')
while True:
r = notepad.messageBox("Why can't I be in the same position where I was last closed??\r\n\r\nMOVE ME AGAIN\r\n\r\nPress Cancel to quit.", '', MESSAGEBOXFLAGS.YESNOCANCEL)
if r == MESSAGEBOXFLAGS.RESULTCANCEL: break
Definitely can't call it a bug; more of a feature request.
Version: 1.5.4, 32-bit
Realized via https://github.com/bruderstein/PythonScript/blob/3e0245161d87806a6c0bfad72dfcba72d8e7dcc3/PythonScript/src/NotepadPlusWrapper.cpp#L714, so I'm not aware of a parameter to determine the position for https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messageboxa . Seems it might be possible with some extra code: https://stackoverflow.com/questions/55150622/how-to-change-messagebox-position-in-c @sasumner Do you have any experience on positioning the messagebox?
Do you have any experience on positioning the messagebox?
Not anything specific and recent. :-)
My desire would be valuable in the notepad.prompt() situation as well, so I've modified the title of the issue to reflect that. If that one isn't realized as a Windows' messagebox, perhaps it is easier to position it? And then perhaps the notepad.messageBox() could be more like the "prompt" box to make it more positionable as well?
Not sure what is best here, if you're inclined to implement it.