Re: NSAlert strategy advice
Re: NSAlert strategy advice
- Subject: Re: NSAlert strategy advice
- From: Bruce Truax <email@hidden>
- Date: Sat, 18 Dec 2004 17:04:23 -0500
I usually pass something that I can test in the contextInfo paramter. For
example you could sent an integer variable equal to a number from 0 to the
number of alert sheets. Then pass the pointer to the integer in the
contextInfo. Your didEndSelector can then use a switch statement to select
the proper action for each case. This way you can just have one method to
handle all of the alert sheets. If you define the integer values with
#define statements in your file then the switch statement can be easy to
read and self documenting.
Bruce
On 12/17/04 10:06 PM, "Henry Maddocks" <email@hidden> eloquently
wrote:
> I know it was sort of a dumb question, but having a bunch of similar
> named functions that almost do the same thing is a recipe for a cockup.
> I was hoping someone had come up with some clever pattern to reduce the
> maintenance. Maybe using contextInfo and some funky selector thing or
> maybe wrapping them up in their own object...
>
> On 18/12/2004, at 2:50 PM, John Stiles wrote:
>
>> If they all do the same thing, you can use the same selector for each
>> sheet.
>> If they all do different things, well, then you probably need them,
>> right? :)
>>
>> -----Original Message-----
>> From: cocoa-dev-bounces+jstiles=email@hidden
>> [mailto:cocoa-dev-bounces+jstiles=email@hidden] On
>> Behalf Of Henry Maddocks
>> Sent: Friday, December 17, 2004 5:22 PM
>> To: email@hidden
>> Subject: NSAlert strategy advice
>>
>>
>> My current app has quite a few occasions when it needs to show a sheet
>> to the user. It seems for each of these sheets I need to implement a
>> sheet did end function which is getting to be a bit laborious and
>> strikes me as being a maintenance nightmare. Does anyone have any ideas
>> for ways this boiler plate stuff can be reduced?
>>
>> Henry
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden