[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
One Question
From: |
Yen-Ju Chen |
Subject: |
One Question |
Date: |
Wed, 25 Apr 2001 22:22:46 -0400 |
I met a strange question.
I design a Delegate class as the delegate of NSApplication,
and this Delegate will create one or more Window class to show up the
window.
Then if Window class has a method, Black,
and the Delegate want to use this Black method,
I write this code in Delegate class:
- (void) Red {
Window *myWin = [NSApp keyWindow];
[myWin Black];
NSLog (@"Red");
}
When no Window created, the program just shows "Red", which is expected.
When I create the Window, the program has a error:
NSWindow can't recognize Black.
Is it right ?
I set one menu to use the Red method, action: @selector(Red);
but I don't think it matters.
So how could I call Black in Window from Delegate ?
PS. Delegate is inherited from NSObject,
and Window from NSWindow.
Thanx a lot!!
- One Question,
Yen-Ju Chen <=