Skip navigation.
 
mlBeginner NSAlert question
FROM : Paul Bruneau
DATE : Tue Nov 06 17:29:18 2007

Hi-

I'm trying to understand the right way to use an NSAlert regarding 
where it should be handled (MVC) and how many didEndSelector methods 
I should have.

I have a window where a button allows me to perform a task (called -
complete) on the currently-selected orderStep object that appears in 
a custom view. To perform the task, my view controller (which, right 
or wrong handles controller tasks for the view and the window) sends 
a message to the orderStep object, in whose class appears the -
complete code.

In the middle of this -complete code, an alert might be required. Do 
I put the alert code in the orderStep class, or in the controller 
class? The task definitely "belongs" to that object so my feeling is 
that the alert is part of that and belongs there. But putting alert 
code in my model seems wrong.

But as wrong as it seems, it also seems wrong to tie this task into 
my controller object since this task might need to be performed from 
any number of other places in my application that have nothing to do 
with the view or its controller.

And is it common for people to use a single didEndSelector for 
several alerts? or should I always make a new method for each alert 
every time?

In my pre-Cocoa life, it was my nature to put something like an alert 
asking a simple yes or no question inline in the code that needs the 
answer so having to decide where to put this code is a puzzle for me. 
I'd rather not have a separate didEndSelector at all.

Thanks for any insights

Related mailsAuthorDate
mlRe: Beginner NSAlert question Keary Suska Nov 6, 17:25
mlBeginner NSAlert question Paul Bruneau Nov 6, 17:29
mlRe: Beginner NSAlert question Paul Bruneau Nov 6, 21:40
mlRe: Beginner NSAlert question David Spooner Nov 6, 22:50
mlRe: Beginner NSAlert question Uli Kusterer Nov 6, 23:40
mlRe: Beginner NSAlert question Paul Bruneau Nov 7, 17:14