trying to glue a cocoa ui to a pthread application / subclassing nsview
trying to glue a cocoa ui to a pthread application / subclassing nsview
- Subject: trying to glue a cocoa ui to a pthread application / subclassing nsview
- From: Michael Toy <email@hidden>
- Date: Mon, 02 Jun 2008 19:49:40 -0700
trying to put a cocoa ui on an existing pthreads app. need to figure out how to let some random thread report to the ui that re-drawing the view would be a good idea.
here is what i am trying to do, and this could be quite stupid but this is the best i've been able to figure out all by myself.
in my view class i do
- (id)initWithFrame:(NSRect)frameRect
{
[super initWithFrame:frameRect];
cache_view_obect(self);
}
- (void)dataIsDirty
{
[self setNeedsDisplay:YES];
}
in my application delegate i do
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSView* dataview = get_cached_view();
tell_pthread_app_about_nsview(dataview);
}
and then deep in my pthread code i do:
if (ns_view_object) {
[ns_view_object performSelectorOnMainThread:dataDirtySelector withObject:nil waitUntilDone:NO];
}
what I find is that my initWithFrame method is not being called ... so i have two questions ...
my drawRect: IS being called, so I know my custom view is being instantiated. why is my init not being called? i thought i figured out the documentaiton enough to understand that the phrase "This method is the designated initializer for the NSView class. Returns an initialized object." meant that this was the only method i needed to write to have custom behavior at creation time.
forget that, is there another way to win?
thanks in advance, i am happy to accept pointers to the documentation i should have found.
-michael
_______________________________________________
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