Re: How to draw background image in my app window

2009-06-01 Thread cocoa learner
On Sun, May 31, 2009 at 9:37 PM, Andy Lee wrote: > On May 31, 2009, at 8:51 AM, Uli Kusterer wrote: > > Another approach would be to try changing the class of your content view in > Interface builder. Simply click the background of the window, that should > show the content view in the inspector.

Re: How to draw background image in my app window

2009-05-31 Thread Andy Lee
On May 31, 2009, at 8:51 AM, Uli Kusterer wrote: Another approach would be to try changing the class of your content view in Interface builder. Simply click the background of the window, that should show the content view in the inspector. Go to the "Identity" tab and change the class to NSIm

Re: How to draw background image in my app window

2009-05-31 Thread Uli Kusterer
Am 30.05.2009 um 19:45 schrieb cocoa learner: Yah Andy and Michael you all were right. But still I have some problem.1>. While resizing the window Image is not getting resized. You could probably fix that using setImageScaling: on the image view. 2>. My controls (NSButton and NSTextField)

Re: How to draw background image in my app window

2009-05-30 Thread M Pulis
No, the conclusion is : That _is_ the easy and straight way to do it. Subclassing is your power and friend, my friend. Once you understand what those lines actually do, you should have a different point-of-view. "Embrace the subclass, for they know what they are doing." :-) gary On May 30,

Re: How to draw background image in my app window

2009-05-30 Thread cocoa learner
Ok. Let me try this.So conclusion is there is no easy and straight way to do it. Have to subclass NSView. Thanx Michael. Cocoa.learner On Sun, May 31, 2009 at 1:12 AM, Michael Vannorsdel wrote: > You'd really be better off making an NSView subclass and having it draw the > image you want in draw

Re: How to draw background image in my app window

2009-05-30 Thread Michael Vannorsdel
You'd really be better off making an NSView subclass and having it draw the image you want in drawRect:. - (void)awakeFromNib { myImage = [[NSImage alloc] init [self setNeedsDisplay:YES]; } - (void)drawRect:(NSRect)rect { NSSize isize = [myImage size]; [myImage dr

Re: How to draw background image in my app window

2009-05-30 Thread cocoa learner
Yah Andy and Michael you all were right. But still I have some problem.1>. While resizing the window Image is not getting resized. 2>. My controls (NSButton and NSTextField) are not visible after the awakeFromNib call. Here is modified code - - (void) awakeFromNib { if (appWindow == NULL) { N

Re: How to draw background image in my app window

2009-05-30 Thread Michael Vannorsdel
You're creating an NSImage and pretending it's an NSImageView which it's not. You'll need to create a new NSImageView and then the NSImage and set the image as the imageview's image. On May 30, 2009, at 8:27 AM, cocoa learner wrote: Thanx Nick for your reply.But in my window I am not getti

Re: How to draw background image in my app window

2009-05-30 Thread Andy Lee
I suspect appWindow is nil, which you can check with one more NSLog: NSLog(@"appWindow is %@", appWindow); Your init method is being called before the nib file has completely loaded, so not all the connections have been made yet. Try adding an awakeFromNib method and moving your code th

Re: How to draw background image in my app window

2009-05-30 Thread cocoa learner
Thanx Nick for your reply.But in my window I am not getting the image I want to display. Here is my code - - (id) init { [super init]; NSLog(@"AppController::init : Setting the windows content"); NSBundle *myBundle = [NSBundle mainBundle]; if (myBundle == NULL) { NSLog(@"AppController::init

Re: How to draw background image in my app window

2009-05-26 Thread Nick Zitzmann
On May 26, 2009, at 11:04 AM, cocoa learner wrote: How to draw background image in my app window? You could change the window's content view using -setContentView: to a view that will draw a background image, such as NSImageView... Of course, if you have any other controls in the content