• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Returns from a sheet
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Returns from a sheet


  • Subject: Re: Returns from a sheet
  • From: Sherm Pendley <email@hidden>
  • Date: Fri, 3 May 2002 15:58:04 -0400

What is the best way to differentiate between an 'OK' button and a 'Cancel' button when closing a sheet? Should I connect the buttons to different exit procedures or is there some way to use the 'returnCode' variable to distinguish between the two?

If you'd prefer to use 'returnCode', you can assign a unique integer "tag" to each button in IB, and connect both buttons to the same action method. In that action method, you'd do something like this:

[NSApp endSheet: mySheet returnCode: [sender tag]];

Whatever return code you give to endSheet:returnCode: is passed along to your callback.
If you'd prefer to not use returnCode, you can check the button's label, or compare outlets, as others have suggested.

sherm--

Never put off until tomorrow what you can do today. There might be a law against it by that time.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: 
 >Returns from a sheet (From: James Pengra <email@hidden>)

  • Prev by Date: Re: What are Tags
  • Next by Date: Re: Returns from a sheet
  • Previous by thread: Returns from a sheet
  • Next by thread: Re: Returns from a sheet
  • Index(es):
    • Date
    • Thread