[nvda-addons] Re: Clipspeak Update

  • From: James Scholes <james@xxxxxxxxxxxxx>
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Thu, 20 Apr 2017 15:38:36 +0100

Damien Sykes-Lindley wrote:

The loop is used to enumerate all the available formats on the
clipboard, not to monitor updates.

Okay.  My mistake after only giving the code a cursory look-over.

Even if I were to use a clipboard listener I think I would still
need to monitor for controls in some form or other, as I ultimately
want the addon to be able to differentiate between copy/cut
operations on invalid controls (for instance on a button), on a valid
control but with no valid data (such as on a text field with no text
selected), and operations that are in fact valid but for some reason
there has been no change on the clipboard.

That was partly my point earlier.  If you're using a clipboard listener,
you'll only receive notifications when the clipboard data actually
changes.  Therefore if the user is focused on a button or other control
which has no clipboard capabilities, pressing the keystrokes won't do
anything.  I understand, though, that you want to speak a message even
if the clipboard-related action has had no effect.  I personally think
this makes the add-on a bit too verbose but that's a matter of personal
taste and your choice to make, and you're right that a clipboard
listener would not help in those cases.  Perhaps an enhancement to
consider for future versions is a small Options dialog allowing the user
to decide the level of feedback the add-on gives them?

That, and from what I can gather a clipboard listener only posts a
WM_CLIPBOARDUPDATE message, so wouldn't give you information as to
what exactly changed (file, text, data etc).

This is correct - you'd need to retrieve the clipboard content in
response to receiving the WM_CLIPBOARDUPDATE message.

I'm going to have to either learn GUI's in the Windows API by way of
 PyWin32, or learn how to add to existing WXPython gui's and how to
make it cooperate with Windows API messages.

The latter method is much easier and you'll find a recipe to do just that on the wxPython wiki:

https://wiki.wxpython.org/HookingTheWndProc

I've successfully used the approach described on that page in an NVDA add-on before (to handle WM_CLIPBOARDUPDATE messages as it happens).
--
James Scholes
http://twitter.com/JamesScholes
----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting bugs.
Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: