Correct event / 'trigger when' to determine which tab is active after NPP start?
-
Two cases:
-
Click on another tab …
NPPN_BUFFERACTIVATED is the notification,
and i could determine the belonging file name(path now. This is correct? -
Start NPP with restoring e.g. 6 files / tabs.
When NPP starts, i’d like to be informed that all files have been opened and one tab is marked as selected.
By what event i can be sure i can determine the belonging file name/path now?
For this example - NPP starts, 6 files / tabs opened - i could trace the following event order:
NPPN_BUFFERACTIVATED
NPPN_BUFFERACTIVATED
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_BUFFERACTIVATED
NPPN_BUFFERACTIVATED <== this last one appears to be the relevant here
The first three ‘bufferactivated’ events obviously shouldn’t be processed without need.
But by which measure it’s normally achieved that now it’s the time i can begin … ?
Btw., NPPM_ACTIVATEDOC i hadn’t seen here at all.
-
-
Click on another tab …
yes, after changing tabs, NPPN_BUFFERACTIVATED is the indicator that it’s been activated.
When NPP starts, i’d like to be informed that all files have been opened …
By what event i can be sure i can determineHave you tried NPPN_READY ? I’ve never looked into the exact timing, but that’s supposed to be the indicator that N++ is ready after first being launched, so my guess would be that it would occur after all files have been opened. If my guess is right, you could probably process that notification, and then send the NPPM_GETFILENAME for getting the active file’s name.
-
@PeterJones Thanks Peter!
-> Have you tried NPPN_READY
Not yet, but i had already the rough idea, that, hm, there should be some notification that NPP had started, and so i’d need only to focus onto the last ‘bufferactivated’ before … i think that’s just something you pointed me to. I’ll try that, thank you! -
I got this (remembering sometimes i’d already seen ‘bufferactivated’ 4 times at the end):
…
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_FILEOPENED
NPPN_BUFFERACTIVATED
NPPN_BUFFERACTIVATED
NPPN_READY
NPPN_BUFFERACTIVATED
NPPN_BUFFERACTIVATEDI think that should point to the right direction. Would only need to try out something meaningful with the last BufferIDs …
I’ll try to check, how. after NPPN_READY,- NPPM_GETFILENAME for getting the active file’s name
- resp. NPPM_GETCURRENTBUFFERID, NPPM_GETFULLPATHFROMBUFFERID etc. for the path
will behave.
-
Yep. works perfectly … NPPN_READY gave the solution …