Re: NSView and NSMenuItem not updating displays
Re: NSView and NSMenuItem not updating displays
- Subject: Re: NSView and NSMenuItem not updating displays
- From: Matt Wilks <email@hidden>
- Date: Fri, 4 Feb 2005 16:15:31 -0500
- Mail-followup-to: Matt Neuburg <email@hidden>, email@hidden
- Organization: Computing and Networking Services
On Fri, Feb 04, 2005 at 08:25:07AM -0800, Matt Neuburg wrote:
> On Thu, 3 Feb 2005 15:57:09 -0500, Matt Wilks <email@hidden>
> said:
> >I've got a custom NSView and a couple of NSMenuItems (in the main menu)
> >declared like so:
> >
> > IBOutlet ConnectStatus *status = [[ConnectStatus alloc] init];
> > IBOutlet NSMenuItem *connectItem = [[NSMenuItem alloc] init];
> > IBOutlet NSMenuItem *disconnectItem = [[NSMenuItem alloc] init];
>
> If you are creating these objects yourself, then in what sense are these
> IBOutlets?
I define them in the AppController.h file:
IBOutlet ConnectStatus *status;
and then intialize them in the 'init' function of AppController.m as
above. I didn't think that I had to initialize them at first, but when
I include the the initialization the NSLog statments I have in the
ConnectStatus NSView are at least outputting. If I don't initialize
them in 'init', I get no feedback from ConnectStatus.
> >I am having trouble getting them to update their displays during
> >execution of the program. The MenuItems are being enabled and disabled
> >like:
> >
> > [connectItem setEnabled:YES];
> > [disconnectItem setEnabled:NO];
> >
> >And the custom NSView something like:
> >
> > [status setColor:[NSColor redColor]];
> > [status setString:@"DISCONNECTED"];
>
> What makes an NSView display is what its drawRect says. The way a menu item
> is enabled depends on your response to validateMenuItem:. m.
Yes, I am pretty sure that my drawRect is correct since it draws what I
want the first time round. The problem comes when I try to make updates
to the NSView.
--
Matthew Wilks
University of Toronto Computing and Networking Services
(416) 978-3328 email@hidden
4 Bancroft Ave., Rm. 102 Toronto, ON M5S 1C1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden