Re: Window not showing
Re: Window not showing
- Subject: Re: Window not showing
- From: "Rob Napier" <email@hidden>
- Date: Wed, 12 Mar 2008 22:42:08 -0400
Your problem is that you have two separate Progress objects (or possibly
only one Progress object that doesn't point to anything). The Progress
object that you alloc in appDidFinish has nothing to do with your NIB and no
knowledge of your NIB objects.
NIB-loaded objects all have to be tied together. Cocoa has no way to
magically know that you want this Progress object to be wired to particular
controls. If you check progressPanel, you will find that it is nil.
To solve this, Progress needs to be instantiated in the NIB and wired into
Controller. You may want to rethink Progress a bit and decide if it's really
ProgressController, ProgressWindow, or ProgressWindowController. It looks a
lot like an NSWindowController.
-Rob
On Tue, Mar 11, 2008 at 7:16 PM, Mr. Gecko <email@hidden> wrote:
> Hello I am having trouble showing a window. I am sure IBOutlet
> NSWindow *progressPanel; is connected to the window in interface
> builder, I am sure mine [progressPanel orderFront:self]; works because
> I did it for the main window at start up. One thing I'm not sure
> about is my method to show it and the way I'm calling it with another
> class.
> Here is the way I am calling it with my other class.
> #import "Progress.h"
>
> @implementation controller
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
> #pragma unused(notification)
> Progress *progress = [[Progress alloc] init];
> [progress showProgressPanel:NO title:@"Downloading" icon:[NSImage
> imageNamed:@"logo"] info:@"Downloading files"];
> [mainWindow orderFront:self];
> }
> @end
>
> [mainWindow orderFront:self]; works I see the main window at launch
> even when I have visible at launch unchecked.
>
> Here is my header for Progress.
> #import <Cocoa/Cocoa.h>
>
>
> @interface Progress : NSObject {
> IBOutlet NSProgressIndicator *progressIndicator;
> IBOutlet NSTextField *info;
> IBOutlet NSImageView *icon;
> IBOutlet NSWindow *progressPanel;
> }
> - (void)showProgressPanel:(BOOL)indeterminate title:(NSString *)title
> icon:(NSImage *)iconValue info:(NSString *)infoText;
> @end
>
> And here is the Progress class.
> #import "Progress.h"
>
>
> @implementation Progress
> - (void)showProgressPanel:(BOOL)indeterminate title:(NSString *)title
> icon:(NSImage *)iconValue info:(NSString *)infoText {
> [icon setImage:iconValue];
> [info setStringValue:infoText];
> [progressPanel setTitle:title];
> [progressIndicator setIndeterminate:indeterminate];
> [progressIndicator startAnimation:self];
> [progressPanel orderFront:self];
> }
> @end
> If someone can help me figure this out I'll be very grateful. Thanks,
>
> Mr. Gecko
>
--
"Those who would give up essential liberty to purchase a little temporary
safety, deserve neither liberty nor safety." -- B. Franklin, Printer
_______________________________________________
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