Skip to content

Author: Paul Lefebvre

Accessing the User Interface from a Thread

Perhaps you already knew, but with desktop apps it has always been considered bad form to directly access any part of your user interface from within a Thread. Alas, even though this was frowned upon, it generally worked in most of your desktop apps.

Starting with 2013r1, this no longer works with Xojo for Cocoa apps. If a Cocoa app tries to access the UI from a thread, a ThreadAccessingUIException is raised. But what exactly does “accessing the UI” mean? In the case of Cocoa, it means any access to a built-in property or method on any UI control or Window. You can access your own methods or properties added to control subclasses as long as they do not access the UI themselves.

Comments closed