Edit AllPages

Hi, folks, and sorry my english. I have such a problem in my app, but i’ll show it on an simple example.

So as you can see i’ve started timer pointed to ‘update’ function, where simply opening and drawing bmp file. But is not drawing! Only ‘white’ area ov NSImageView in my gui. What is the problem? May be you know.. (( The thing is that when i’m not runnig NSTimer and simply run ‘update’ BMP is normaly drawed…

This is because you need to add it to the NSRunLoop first:

Also, this method should be -(void), as it doesn’t return any object. -(id) methods are used when you need to return various object instances. You may return _timer.

No he doesn’t. The scheduled in the method name means that the timer has already been added to the run loop for you.

Not sure about this, but doesn’t @selector(update) point to -(void)update; instead of -(void)update:(id)sender; (which would be @selector(update:))?

You may need to force drawing here. After you set your image view’s image, call: [myImageView display]; … that may fix it.

I’ve already tried force redraw, nothing new.. There is one more thing that i’ve not undisclosed. I’m grabbing frames from camera, i mean system web camera, by QuickTime components like SGStartRecord.. and then having some frame data i’m trying to draw it in NSImageView.. For now i suppose that it’s the problem of some type of SequenseGrabber loop.. and i don’t know were and what for to look at..

int opencam (…) { grabber = OpenDefaultComponent (SeqGrabComponentType, 0);

…. result = SGSetDataProc (grabber, NewSGDataUPP(dataproc), (long) capture) …. result = SGStartRecord (grabber); ….

dr = new Dr(); dr->taskgrabber(grabber);

return 1; } //init components

OSErr dataproc (SGChannel channel, Ptr data, long len, long *, long, TimeValue time, short, long refCon) { handledata(data);
return noErr;

} //callback

void handledata(void* data) { …
dr->drawframe(data, roi); …

return; } //editing data

void Draw::drawFrame(void* data, mySize roi) { … NSImage* outimage = [[NSImage alloc] initWithSize:NSMakeSize(roi.width, roi.height)]; [myViewClass updateImage:outimage];

} // another editing data an send it to redraw. For NOW it’s not used!!

void Dr:: taskgrabber(SeqGrabComponent grabber) { //[myViewClass setgrabber:grabber]; [myViewClass update];

} // need to show my SeqGrabComponent to another class. For NOW it’s used for simply file drawing function calling

So if i’ll call (id)update - i can see BMP. But if i call first sequencegrabber initialization and so on - and finaly coming to (id)update - i CAN’T see Bmp (( Its path is opencam()-> taskgrabber()-> (id)update for now, i other word initialization and drawing opened image..

Well i’ve tried one more thing, i’ve comented opencam (…) function except calling dr->taskgrabber(grabber); … Nothing new) So it’s now the problem of camera initialization..