how to call fathers setNeedsDisplay from child.

Nibbie
Posts: 3
Joined: 2006.12
Post: #1
hy everybody. i am from slovakia, so excuse my english Wink

i have two NSOpenGLView in two class. Pirates.h is father and Objects.h is child. i need to refresh NSOpenGLView in Pirates.h from Objects.h. in child when i call [super setNeedsDisplay:YES]; it refresh a child's View not a father's View. in Pirates.m is this function

- (void)refresh
{
NSLog(@"Refreshing");
[self setNeedsDisplay:YES];
}

when i call it from Objects.m like [super refresh]; it refresh child's View.

any ideas how can i refresh fathers NSOpenGLView?
Quote this message in a reply
Member
Posts: 204
Joined: 2002.09
Post: #2
Code:
[[child superview] setNeedsDisplay:YES];
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2006.12
Post: #3
did you meen that i will call this in Objects.m?

[[self superview] setNeedsDisplay:YES];

becouse it not work Blush
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #4
Maybe it would be useful to take a look at example code?
http://fax.twilightcoders.net/files/Coco...cation.zip

(its an xcode template btw so you'd need to put it in "/Library/Application Support/Apple/Developer Tools/Project Templates/Application/" to actually use it)

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Member
Posts: 204
Joined: 2002.09
Post: #5
You referred to the superview as "pirate" and the child view as "child", so I was following your terminology. If you have one view "inside" (a subview) of another view, then you can access the parent view by calling -superview on the child view.
Quote this message in a reply
Nibbie
Posts: 3
Joined: 2006.12
Post: #6
in InterfaceBuilder i create an Outlet type Pirates named pirat. and i create connetion between Class Pirates and object pirat. in Pirates.m in function refresh i call "[pirat setNeedsDisplay:YES];" and it work wery well. thanks guys for helping Wink
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  cocos2d: memory question adding child to scenes sefiroths 8 9,637 Apr 19, 2011 08:06 AM
Last Post: OneSadCookie
  Child Units grazhoper 1 2,615 Sep 2, 2009 12:25 AM
Last Post: AnotherJake
  drawRect: is not executed after setNeedsDisplay:YES Moridin 7 8,158 Oct 19, 2005 12:42 AM
Last Post: Moridin
  Is there a system call to open HTML file programatically? WhatMeWorry 12 4,490 Sep 28, 2005 05:54 PM
Last Post: Steven
  Call For Help: The Game Track Open Source Project jolivierld 2 2,612 Aug 30, 2005 03:48 AM
Last Post: jolivierld