Re: Creating a window when pressing a button
Re: Creating a window when pressing a button
- Subject: Re: Creating a window when pressing a button
- From: Damien Cooke <email@hidden>
- Date: Wed, 10 Dec 2008 12:22:05 +1030
Jushin,
Here is an example loading from nib within an action method
- (IBAction)showMyNewWindow:(id)sender
{
NSLog(@"Loading Nib");
if(!myNewWindow)
{
[NSBundle loadNibNamed:@"MyNewWindow" owner:self];
}
[myNewWindow makeKeyAndOrderFront:nil];
}
On 10/12/2008, at 12:16 PM, Damien Cooke wrote:
Jushin,
What I have done in the past with these sort of issues is either
load the nib in the button pushed action or depending on how
complicated your secondary window is, you could programatically
create it like this.
myWindow = [[NSWindow alloc] initWithContentRect:myRect
styleMask:NSTitledWindowMask|NSResizableWindowMask
backing:NSBackingStoreBuffered defer:YES];
Hope that gives you some ideas?
Damien
On 10/12/2008, at 7:54 AM, Jushin wrote:
In my application, I have to open a form window when a user press a
button.
It is somewhat similar to Apple Mail. In Apple Mail, if you click
"New
Message" button from the toolbar, a "New Message" window is appeared.
For now, what I did was something like this:
In IB, I added a window (or a panel), and the associated button shows
the window by using makeKeyAndOrderFront method when pressed.
However, I realized it is not what I want.
In this case, a window is already created, and the button only shows
or hides the window.
What I want is really creating a window when a user presses the
button, so that the user can creates multiple windows by pressing the
button.
I wonder how can I do this.
The window will contain form fields to get values for Core Data
models.
Thanks,
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
I Remenber When Synthesizers were Analogue
Programs were somthing you watched on T.V
and a hard drive was from Sydney to Adelaide!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
I Remenber When Synthesizers were Analogue
Programs were somthing you watched on T.V
and a hard drive was from Sydney to Adelaide!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden