• 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: Document app: NSWindowController: Finding the NSWindow* for the controller window.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Document app: NSWindowController: Finding the NSWindow* for the controller window.


  • Subject: Re: Document app: NSWindowController: Finding the NSWindow* for the controller window.
  • From: Christiaan Hofman <email@hidden>
  • Date: Sat, 11 Feb 2012 11:32:18 +0100

Have you connected the window outlet in your NIB?

Christiaan

On Feb 11, 2012, at 11:09, Clark Williams wrote:

> I have a document app.
> In the document .m file I create a subclassed NSWindowController called CalculatorWindowController as follows:
>
> - (void) makeWindowControllers
> {
> 	// This works fine as the 'magic calculator' window appears and all actions and outlets work fine.
> 	if ( nil == sbcWC ) { // insure there is only one calc window open at a time
> 		sbcWC = [[CalculatorWindowController alloc] initWithWindowNibName:@"CalculatorWindowController"];
> 		[self addWindowController:sbcWC];
> 	}
> 	// Make more window controllers each from their own xnib files.
> 	// (I actually create several window controllers but they don't need to be resized.)
> }
>
> Now I want to resize the sbcWC window when certain conditions happen and then resize the window back again when those conditions no longer exist.
> To do this I believe I should be sending the following message:
>
> [[sbcWC window] setFrame:binaryWindowFrameSize display:YES animate:YES];
>
> But the value returned for [sbcWC window] is always nil. I cannot get the window pointer to obtain the frame size nor to resize the window.
>
> In the CalculatorWindowController the user can calculate how much of this magic or that magic is necessary and mix the magic sources as necessary to counteract spells, blunders and incoming holocausts, etc. Under certain conditions the window should expand in width to show a larger output and then collapse back to regular size when the conditions are removed.
> When the conditions exists I use a NSNotification indicating an "ACCOUNTING" condition is necessary. When the conditions return to normal I use a NSNotification indicating an "NON_ACCOUNTING" conditions. In the Document .m file I have the following selector:
>
> - (void) sbCalculatorCmdAccountingDeptDisplay:(NSNotification*)theData
> {
>    NSString *displayType = [NSString stringWithFormat:@"%@", [[theData userInfo] objectForKey:ACCOUNTING_DEPT_DISPLAY_SB_CALCULATOR_CONTROLLER]];
>    NSLog ( @"Set calculator display %@", displayType );
>    if ( [displayType isEqualToString:@"ACCOUNTING"] ) {
>        [[sbcWC window] setFrame:accountingWindowFrameSize display:YES animate:YES];
>    } else {
>        [[sbcWC window] setFrame:nonAccountingWindowFrameSize display:YES animate:YES];
>    }
> }
>
> The accountingWindowFrameSize is 120 pixels wider in size than the nonAccountingWindowFrameSize.
>
> The sbcWC does not change in size when either notification is received.
> When I breakpoint or NSLog the value for [sbcWC window] it is ALWAYS nil (0x0).
> Which means that I cannot get a meaningful value for:
> [[sbcWC window] frame].size.width
>
> How do I get the NSWindow* for sbcWC?
>
> Any suggestions would be appreciated.
> TIA
> ClarkW
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users 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.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


References: 
 >Document app: NSWindowController: Finding the NSWindow* for the controller window. (From: Clark Williams <email@hidden>)

  • Prev by Date: Document app: NSWindowController: Finding the NSWindow* for the controller window.
  • Next by Date: ibtool exception
  • Previous by thread: Document app: NSWindowController: Finding the NSWindow* for the controller window.
  • Next by thread: ibtool exception
  • Index(es):
    • Date
    • Thread