cheesestraws
Well-known member
There doesn't seem to be a good walkthrough or discursive tutorial on how to build Chooser Extensions out there, or indeed why one would want to. Furthermore, when I sat down and tried to learn it, it turns out that Inside Macintosh is wrong in some important ways and the other documentation I have is unhelpful, with one honourable exception.
So, over the next few days in this thread I'm hoping to write up a bit of a HOWTO, along with a fully working skeleton Chooser extension that I am going to upload to github.
But before we get to how, we should address the question of why you would want to, compared to, say, writing a control panel. Really, there are two reasons:
Of course, option 2 is an ambiguous virtue, because you lose a lot of control over the UI. Occasionally, one comes across software that is wedging far, far too much into a Chooser Extension, and because you don't have much in the way of UI control, one ends up with alarmingly complicated series of dialog boxes. Farallon Liaison comes to mind here, which is an AppleTalk router that is configured, for some bizarre reason, exclusively out of the Chooser. It's not ideal.
You can do a lot of the other things you can do with control panels with Chooser extensions too: perhaps most importantly, you can combine them with INIT resources in the same way, so you can have your chooser extension configuring your system extension. I'm not going to talk about that much here, because how to write INITs is a much better-documented thing.
So, to summarise: if you want a simple "network browser" or similar UI, a Chooser extension might be a good choice. If you want more, you might be better off looking at a control panel or, indeed, an application.
So, over the next few days in this thread I'm hoping to write up a bit of a HOWTO, along with a fully working skeleton Chooser extension that I am going to upload to github.
But before we get to how, we should address the question of why you would want to, compared to, say, writing a control panel. Really, there are two reasons:
- First, a Chooser Extension is the idiomatic way to present a list of resources or devices connected to the Mac and getting the user to pick one under Systems 6 and 7. If the UI you want is a "network browsing" one, then a Chooser Extension is the right answer.
- It's actually rather easy. The Chooser manages the UI for you, and if you're interfacing with an AppleTalk service, then the Chooser will also manage the network code and service discovery for you. You get a lot of usability with very little code.
Of course, option 2 is an ambiguous virtue, because you lose a lot of control over the UI. Occasionally, one comes across software that is wedging far, far too much into a Chooser Extension, and because you don't have much in the way of UI control, one ends up with alarmingly complicated series of dialog boxes. Farallon Liaison comes to mind here, which is an AppleTalk router that is configured, for some bizarre reason, exclusively out of the Chooser. It's not ideal.
You can do a lot of the other things you can do with control panels with Chooser extensions too: perhaps most importantly, you can combine them with INIT resources in the same way, so you can have your chooser extension configuring your system extension. I'm not going to talk about that much here, because how to write INITs is a much better-documented thing.
So, to summarise: if you want a simple "network browser" or similar UI, a Chooser extension might be a good choice. If you want more, you might be better off looking at a control panel or, indeed, an application.