Make VoiceOver announce text pre-10.9 - macos

I want VoiceOver to speak some text in an NSTextView that it won't say spontaneously, basically text added programmatically while the view has focus. OS X 10.9 added the NSAccessibilityAnnouncementRequestedNotification API as a way to do this (although it for some reason says macOS 10.7+ on the Apple documentation page), but I want my app to work on 10.7 as well.
EDIT: I made the code using NSAccessibilityAnnouncementRequestedNotification compile and run on 10.7 (by adding a number of missing definitions), but it seems to have no effect prior to 10.9.
I think I've worked out a way to trick VoiceOver into thinking that the text I want it to speak is selected, (basically returning the string and the range I want to be read when asked for the NSAccessibilityAttributedStringForRangeParameterizedAttribute or NSAccessibilitySelectedTextRangeAttribute) and then post a NSAccessibilityValueChangedNotification. This pretty much works, but makes VoiceOver say "Selection Replaced" whenever the user starts typing anything in the text view, on any OS newer than 10.7.
So, my question is: Is there a better way to do what I want?

Related

tcl/tk GUI macOS speech to text (dictation)

I am working on my Tcl/Tk GUI (written through Tcl::pTk in Perl). Am I correct that Tcl/Tk widgets (entry, text, etc.) can not take as input the Speach to Text (Dictation) input of macOS (HighSierra)? I can input in pretty any software I have installed on my computer, exept from my own GUI and another software written in Tcl/Tk. Is there anything I can do, or I just have to accept it as not possible to achive?
Cheers
Kelly
I tried the widget demos for both Tcl/Tk and Tcl::pTk (which is something I've been doing rather often to check if an issue is in Tcl/Tk or just Tcl::pTk). I'm using Tk 8.6.8 on macOS 10.13.6 (note that recent macOS comes with an older version of Tcl/Tk: 8.5.9 on macOS 10.13).
I'm able to press fn twice to dictate into Tcl/Tk text and entry demos just fine:
But for the Tcl::pTk demos, I can't get it to work for an entry widget, and it's difficult to get it to work for a text widget (sometimes the dictation balloon doesn't show up on the first try, or if I focus on another text widget, then the dictation balloon might appear for that other widget instead).
Sometimes the dictation balloon shows up for ROText widgets, which doesn't cause anything to get typed, but still isn't ideal.
I'm not sure what's preventing dictation from working in Tcl::pTk, but since this is a rather basic accessibility feature, it would be great if it worked. This would be good for a bug report/feature request for Tcl::pTk.
Update: I've since observed difficulty using dictation even in pure Tcl/Tk examples, so I've opened a ticket: https://core.tcl.tk/tk/tktview/fdbdcc8c3c

PDFThumbnailView: Not able to select thumbnails in Sierra for MAC OSx App

I am using PDFKit. Please refer here
PDFThumbnailView does not allow to drag or select the thumbnail after I have updated my Mac OS x to Sierra.
Have already set
[_pdfThumbnailView setPDFView:_pdfView];
and _pdfThumbnailView outlet from xib too.
If works well for previous OS x version.
Any help will be appreciated.
Thanks!!
Apple really screwed PDFKit in MacOS 10.12, among the many other bugs in it, PDFThumbnailView is unusable for the most part, it doesn't do anything except displaying a list of pdf pages (with glitches).
I've spent much time into this but I couldn't find any workaround. I'm afraid your options are either waiting for Apple to fix this (hopefully) or rolling out your own thumbnail view replacement.
Creating your own thumbnail view shouldn't be overly complicated. I'd use NSCollectionView and render the thumbnails into its grid. Then wire all the selection and drag and drop with the PDFView. I'm planning to do exactly this if Apple doesn't fix PDFThumbnailView anytime soon.
(ps: there is a nice tutorial on NSCollectionView on raywenderlich.com )

NSScrollView printing inverted on OSX Mavericks

I have a Mac app that has been on the app store for a few years. It's a time tracking and invoicing app that creates a PDF for the invoice. The PDF is generated from the content of a window in the app that contains the invoice information. Before OSX Mavericks the PDF printed just as it looked like on screen. Unfortunately in Mavericks, the NSScrollView that I am using for the table is printing horizontally inverted.
PDF as it should look, and how it looked on OSX Lion and Mountain Lion:
PDF as it prints out on Mavericks:
When I searched the Google for this problem I did find another person experiencing what seems to be the same problem.
The NSScrollView is nothing fancy, just an NSScrollView with an NSClipView as its contentView, and an NSTableView inside of that.
I'm really hoping that this is a problem that can be fixed, and not just a bug introduced by Mavericks when printing NSScrollViews. Thanks for any help!
Well, I wouldn't say I found a fix for this, but I was able to make this work normally again. I accidentally found that if I put another identical table in the same view hierarchy as the existing one and hid the new table, the first one would print correctly. Don't ask me why it works, because it feels like some serious cargo-culting, but it made the table inversion go away. I hate these kinds of "fixes".

Cocoa: Global Shortcuts in Lion

I've been looking for a way to implement a global shortcut for my app that would work like shortcut recorder. The problem is I haven't found one that works with the current version of xcode, every single one I've found throws an error in xcode about legacy stuff. The only one i've found that is any good in Lion is DDHotKey, which does exactly what I want, but it has the downside that the user doesn't record the shortcut in a nifty smart textfield sort of thing, its a preset shortcut.
Can anyone tell me how to add a smart textfield to DDHotKet, or a fix for SR in Lion? It seems that for ShortcutRecorder the specific problem has to do with the actual textfield in IB using old plug-ins, so I can't use the text field (which is what I really want). I've looked up a whole bunch of different frameworks but they all have outdated stuff. To be honest even if I found a fix for running SR I still have no idea what to do since it seems to be waaay more complicated than all the others i've found.
This fork of ShortcutRecorder builds in Xcode 4:
https://github.com/youknowone/shortcutrecorder
It also has a nice demo project that shows how to use the API.

Where to put copyright notices in a minimal Mac app's UI?

I am doing a minimal port of a simple iPhone/iPad app (think 2D casual game with a single view) to the Mac (almost nothing has changed in the UI, except swapping touchable Cocoa Touch UI elements for mouse-clickable Cocoa UI elements). In the iPhone app, a little "i" button brings up a text view containing basic instructions, followed by all the required (possibly lengthy) BSD/MIT/Apache/Artistic/et.al. copyright notices and their associated disclaimers for any random borrowed code.
The ported Mac app is intended to be distributed from the Mac App store, so additional README files outside the app bundle/sandbox can't be used. I note that many Mac App store apps do not put this text in the About... box, or use a little "i" button like iPhone apps.
So where do I put the equivalent README text in a Mac App Store app?
I would like this text to be included with the Mac app so that it's viewable from within the app even when the Mac is completely off-line.
ADDED:
I see recommendations for putting all this text in the About... dialog, but, if so, my guess is that many apps are skimping on all the required text that seems to go with many of these licenses (I've seen a few with a page or two of required disclaimers. Which Mac app has all that in the About... dialog?)
Just put a Credits.html or Credits.rtf file in your bundle, it'll automatically be displayed in the dialog that's shown after clicking the "About MyApp" item in the main menu.
Usually, a Mac app includes an «About» window, with the application's icon, name, version number and author.
If you have credits to display, you may display them on that window, if it's only a few lines.
If you have a long text, you should add a «credits» button on the «About» window, that eventually opens a specific credits window, with the text you want.

Resources