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

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


  • Subject: Document app: NSWindowController: Finding the NSWindow* for the controller window.
  • From: Clark Williams <email@hidden>
  • Date: Sat, 11 Feb 2012 02:09:16 -0800

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


  • Follow-Ups:
    • Re: Document app: NSWindowController: Finding the NSWindow* for the controller window.
      • From: Christiaan Hofman <email@hidden>
  • Prev by Date: Re: Does Xcode/Mac come with a PNG util?
  • Next by Date: Re: Document app: NSWindowController: Finding the NSWindow* for the controller window.
  • Previous by thread: Re: creating .c and .h / Xcode is crashing very often
  • Next by thread: Re: Document app: NSWindowController: Finding the NSWindow* for the controller window.
  • Index(es):
    • Date
    • Thread