NSView loaded from bundle won't draw...

Posts: 2
Joined: 2010.11
Post: #1
I am trying to load an NSScreenSaverView and display it in a PrefPane much like Apple's screensaver prefpane's screenssaver preview. I am loading the screensaver bundle and I know that the bundle is loading correctly because I have put an NSLog in a custom screensaver and it is being displayed in the console when I run this PrefPane.
Here's the function where I put my code and the code:
- (void) mainViewDidLoad
    SSBundle = [NSBundle bundleWithPath:@"/System/Library/Screen Savers/Flurry.saver"];

    Class SSBundleClass;

    NSLog(@"Bundle Info\n%@",[ [ SSBundle infoDictionary ] description ] );

    NSLog(@"Found and loaded principalClass");
    theStupidView = [[SSBundleClass alloc] initWithFrame:NSMakeRect(0,0,100,100) isPreview:YES];
    [theStupidView startAnimation];

The description displays properly, the initWithFrame: function is run on the bundle, but I can't get "theStupidView", (IBOutlet id theStupidViewWink to display. Yes, I'm frusterated Rasp. My .h file is linked to DesktopSaverPref in IB. The loaded class is a ScreenSaverView, a subclass of NSView. I really don't understand why it isn't drawing anything.

Joseph Duchesne
Quote this message in a reply
Posts: 114
Joined: 2005.03
Post: #2
You're trying to set an outlet to a different view and hope that the view the outlet was set to changes. This is not possible. Instead, you'll need to add the view to the view hierarchy, i.e. determine a view that it should be a subview of and then use addSubview, replaceSubview or a similar method to add the view there.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  grayscale loaded as gl_alpha: all texture is white sefiroths 2 6,849 Jan 18, 2011 12:34 AM
Last Post: sefiroths
  grayscale loaded as gl_alpha: the opaque image can be only white? sefiroths 2 7,295 Jan 14, 2011 08:06 AM
Last Post: sefiroths
  Mouse Events in NSView Chandhu 1 5,089 Feb 28, 2008 02:08 AM
Last Post: kuon_
  Drawing a subview loaded from a bundle Joseph Duchesne 8 7,361 Feb 14, 2006 08:32 PM
Last Post: PowerMacX
  NSImage and NSView problems Joseph Duchesne 1 4,958 Aug 19, 2005 07:36 AM
Last Post: unknown