Re: NSPanel newbie init question
Re: NSPanel newbie init question
- Subject: Re: NSPanel newbie init question
- From: Luc Vandal <email@hidden>
- Date: Mon, 25 Apr 2005 22:11:16 -0400
Hi!
I guess I was not clear enough :(
I just want to know how to create an instance of a derived NSPanel (NSWindow or whatever) and display it. When it's an IBOutlet (within a NSWindowController), it's initialized by the controller (I assume) so I can use the instance later on. I don't want that. I want to be able to create an instance, initialize it and display it within a function scope.
This code doesn't work. All it does is display a small window:
MyPanel* wnd = [[MyPanel alloc] init];
//Run modal loop
NSModalSession nDlgBrowseSession = [NSApp beginModalSessionForWindow: wnd];
int nRes = 0;
[NSApp runModalSession:nDlgBrowseSession];
for (;;)
{
nRes = [NSApp runModalSession:nDlgBrowseSession];
if ( nRes != NSRunContinuesResponse)
break;
}
Thanks!
Luc
On 25-Apr-05, at 9:00 PM, Dave Rehring wrote:
On 4/25/05 5:29 PM, Luc Vandal at email@hidden wrote:
currently my NSPanels are initialized automatically since they are
IBOutlets. I don't know how to create the panel on the fly. I've tried this
but it only shows a small, blank panel:
Right, it did what you asked.
You created a panel, and asked the system to display it. That's what
happened.
You might want to investigate adding NSButton's to the panel next...
Depending on what you want for the panel's contents, you might also consider
NSAlert...
Later,
--
David Rehring Psychos do not explode when light hits
VP of Research and Development them, no matter how crazy they are...
Atimi Software, Inc.
www.atimi.com And totally insane guy!
_______________________________________________
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:
This email sent to email@hidden