• 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: Linking an NSWindow in IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking an NSWindow in IB


  • Subject: Re: Linking an NSWindow in IB
  • From: Conrad Shultz <email@hidden>
  • Date: Wed, 31 Aug 2011 20:06:08 -0700

Sorry I'm on my phone so I can't write a detailed response, but you're just structuring your app kind of backwards.

In IB you would want to have a connection between your custom window and an outlet in your app delegate in this case. You would then send the window an "order front" message from the app delegate.

Putting an outlet to your window _inside the window_ is counterproductive. (I assume also that you meant for MyWindow to be a subclass of NSWindow, not NSObject.)

(Sent from my iPhone.)

--
Conrad Shultz

On Aug 31, 2011, at 19:54, Guy Halford-Thompson <email@hidden> wrote:

> Hi,
>
> Thanks for the help, I really appreciate it.
>
> I still appear to be having some trouble tho.
>
> Here is my code:
>
> MyWindow.h
> ----------------
> #import <Cocoa/Cocoa.h>
>
> @interface MyWindow : NSObject <NSWindowDelegate> {
>
>   IBOutlet NSWindow *window;
> }
>
> -(void)showWindow:(id)sender;
>
> @property (assign) IBOutlet NSWindow *window;
>
> @end
>
> MyWindow.m
> -------------------
>
> #import "MyWindow.h"
>
> @implementation MyWindow
>
> @synthesize window;
>
> -(void)showWindow:(id)sender {
>   NSLog(@"**Window %@",window);
>   [window makeKeyAndOrderFront:nil];
> }
>
> @end
>
>
> Then... in my main app delegate....
>
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
>
> if {...condition is met....} {
>        MyWindow *uni = [[MyWindow alloc] init];
>        [uni showWindow:nil];
>  }
> }
>
> But its still not working...
>
> Sorry if this is pretty basic, but getting my head round objective C
> is proving to be difficult.
>
> 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
_______________________________________________

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

References: 
 >Linking an NSWindow in IB (From: Guy Halford-Thompson <email@hidden>)
 >Re: Linking an NSWindow in IB (From: Ron Fleckner <email@hidden>)
 >Re: Linking an NSWindow in IB (From: Guy Halford-Thompson <email@hidden>)

  • Prev by Date: Re: Linking an NSWindow in IB
  • Next by Date: Re: setTitleWithMnemonic
  • Previous by thread: Re: Linking an NSWindow in IB
  • Next by thread: Re: Linking an NSWindow in IB
  • Index(es):
    • Date
    • Thread