Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] notepad.flashWindow() #57

Closed
Yaron10 opened this issue May 20, 2018 · 11 comments
Closed

[Request] notepad.flashWindow() #57

Yaron10 opened this issue May 20, 2018 · 11 comments
Labels
Milestone

Comments

@Yaron10
Copy link

Yaron10 commented May 20, 2018

notepad.flashWindow().
Flash the Title Bar and NPP's tab in Windows Task Bar.
(As in Search -> Wrap around).

Thank you.

@chcg chcg added the Feature label May 21, 2018
@ghost
Copy link

ghost commented May 21, 2018

Sorry, do you mean in addition to the existing flash functionality?
Or are you looking for something like this

import ctypes
from ctypes import wintypes

class FLASHWINFO(ctypes.Structure):
    _fields_ = [('cbSize',    wintypes.UINT ),
                ('hwnd',      wintypes.HWND ),
                ('dwFlags',   wintypes.DWORD),
                ('uCount',    wintypes.UINT ),
                ('dwTimeout', wintypes.DWORD),]

npp_hwnd = ctypes.windll.user32.FindWindowW(u'Notepad++', None)
FLASHW_ALL = 0x3

flashw_info = FLASHWINFO()
flashw_info.cbSize = ctypes.sizeof(flashw_info)
flashw_info.hwnd = npp_hwnd
flashw_info.dwFlags = FLASHW_ALL
flashw_info.uCount = 3
flashw_info.dwTimeout = 200

ctypes.windll.user32.FlashWindowEx(ctypes.byref(flashw_info))

@Yaron10
Copy link
Author

Yaron10 commented May 21, 2018

@ClaudiaFrank,

Sorry, do you mean in addition to the existing flash functionality?

If you mean #52, I did request notepad.flashWindow() in addition. I think it's much more useful.

If you add this function, flashw_info.dwTimeout = 100 might be better as NPP uses that value.

👍
Thanks for that too. :)

@ghost
Copy link

ghost commented May 21, 2018

Sorry for not being clear, yes, I was thinking about editor.flash and
if it should be added, personally I think it shouldn't, then with parameters for count and timeout.

@Yaron10
Copy link
Author

Yaron10 commented May 22, 2018

Sorry for not being clear, yes, I was thinking about editor.flash

No problem at all.

personally I think it shouldn't

OK.

with parameters for count and timeout.

That's better. :)

Thanks again.

@sasumner
Copy link

I see this was integrated, and the feature works fine in PS 1.1.0.0; however I don't see notepad.flashWindow() in the help documentation? Is this correct?

Unrelated but also true is that I don't see editor.flash() in the docs either. :(

Should another issue be opened to request that these be added in?

Thru experimentation, here's the documentation I've cobbled together for my own purposes:

notepad.flashWindow(count, timeout_ms)
flashes titlebar/frame/taskbar icon (like N++ does when a search term is not found) count times for a duration of timeout_ms

editor.flash(timeout_ms=50)
inverts the colors of the entire editor window background for timeout_ms time

The only ref. I found to "flash" at all in the docs (the .chm file) was this:

Editor.findIndicatorFlash(start, end)
On OS X, flash a find indicator, then fade out.

Does that even do anything on Windows?

@Yaron10
Copy link
Author

Yaron10 commented Jun 15, 2018

👍

notepad.flashWindow(count, timeout_ms)
flashes titlebar/frame/taskbar icon (like N++ does when a search term is not found)

When a search term is not found, the Find Dialog is flashed.
NPP window is flashed when wrapping-around searches.


BTW, Dave added editor.flash() after a request for notepad.flashWindow() which was misunderstood.
editor.flash() is not really useful IMO.

@sasumner
Copy link

sasumner commented Jun 15, 2018

When a search term is not found, the Find Dialog is flashed

The Find window is only flashed if it is open when the search term is not found when (for ex.) the Find Next button is pressed--this is an obvious statement because it can't be flashed if it isn't open!).

The titlebar/frame/taskbar icon is flashed if the Find window is closed when a command (e.g. Find Next keycombo) is executed and the search term is not found--that was the example I was citing before but I didn't make that clear. Of course I was just echoing what I've scratched down for my own notes, so it can be specific to ME! :)

We BOTH should have been better in discussing this. :)

BTW, Dave added editor.flash()

Yes, I remember the circumstances of editor.flash()'s origins. I don't know...perhaps editor.flash() can be useful... I haven't used it for anything yet, but..

So my main point is that editor.flash() is available but it isn't documented...and it should be...same for notepad.flashWindow(). At least editor.flash() can be used without an argument if someone happens to know of its existence...but if you know about notepad.flashWindow() somehow it is tough to simply guess at its arguments....needs docs!!

@ghost
Copy link

ghost commented Jun 15, 2018

Yes, I simply forgot to add it but in case you find some undocumented function one way which
should always work is using help from within console

>>> help(notepad.flashWindow)
Help on method flashWindow:

flashWindow(...) method of Npp.Notepad instance
    flashWindow( (Notepad)arg1, (int)count, (int)timeout) -> None :
        Flashes notepad++ for the given count and timeout

>>> help(editor.flash)
Help on method flash:

flash(...) method of Npp.Editor instance
    flash( (Editor)arg1) -> None :
        Flash the editor by reversing the foreground and background colours briefly
    
    flash( (Editor)arg1, (int)milliseconds) -> None :
        Flash the editor by reversing the foreground and background colours briefly

Nevertheless, it should be added to chm file

@Yaron10
Copy link
Author

Yaron10 commented Jun 15, 2018

The titlebar/frame/taskbar icon is flashed if the Find window is closed when a command (e.g. Find Next keycombo) is executed and the search term is not found

👍
You're right. Thank you.

So my main point is that editor.flash() is available but it isn't documented...and it should be

That's correct.

@sasumner
Copy link

sasumner commented Jun 15, 2018

Ah, I suppose the code FORCES you to add the console help...that's nice. I think at one point I write some code to "loop thru" everything in the console help and I copied it to a file. That could help in the future when things aren't put in the real docs.

IMO, "timeout" is bad...no time reference. Is it seconds? (I know it isn't, but I shouldn't have to even spend a millisecond(!) thinking about it) :)

"milliseconds" is much better...at least with that I know what I'm getting without having to rely on remembering or experimenting.

Should this issue be reopened until the real docs are corrected? (sorry to be a stickler for detail)

@chcg
Copy link
Collaborator

chcg commented Jun 16, 2018

@sasumner Created a new followup issue for the docu update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants