Re: Need example to open a sheet
Re: Need example to open a sheet
- Subject: Re: Need example to open a sheet
- From: Heath Raftery <email@hidden>
- Date: Fri, 05 Mar 2004 12:53:30 +1100
Hi Rahul,
On 03/03/2004, at 8:42 PM, Rahul Verma wrote:
Can some one give me an example to open a sheet using XCode?? Being a
User
Interface designer, I can not program that part!! Please see if anyone
can
help me with that!!
Here's how I did it:
In my MainMenu.nib file (I used the original nib file because my
application is very small) I added a new NSPanel and populated it as I
liked. I added a new outlet to my main NSWindow object:
@interface startAuthWin : NSWindow
{
/*SNIP*/
IBOutlet NSPanel *credentialsPanel;
/*SNIP*/
}
and connected (control dragged in IB) the newly created Panel to the
Window instance, selecting the credentialsPanel outlet in the
connections information dialog.
Then in the code, where I wanted the sheet to appear, I added this line:
[NSApp beginSheet:credentialsPanel modalForWindow:self
modalDelegate:self
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:theTimer];
Where credentialsPanel is the name of the NSPanel I just created,
sheetDidEnd:returnCode:contextInfo: is another method I added to the
class and contextInfo is an object I wanted to pass along to the
sheetDidEnd method (can be anything).
That's all there is to it! But it did take some fiddling to actually
appear. At first, it kept appearing as a seperate dialog, but a few
saves and rebuilds and I can't remember what else (maybe toggling
attributes on the NSPanel) and it all started to work.
Heath
--
___________________________________________________
| Heath Raftery |
| email@hidden |
| *640KB of RAM ought to be enough for anybody* |
| - Bill Gates |
| _\|/_ |
|____________________________________m(. .)m________|
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.