FROM : delanoy
DATE : Sat Jul 22 19:36:26 2006
Hello all,
I created a subclass of NSTextView (called GGTextView) that differs
from its superclass only by the implementation of the
-pageFooter: method, and I'm trying to "replace
NSTextView with GGTextView everywhere" in the source code
for TextEdit, so that when the new version of TextEdit runs
only the new "-pageFooter:" method is called.
So I replaced NSTextView with GGTextView in the .h and .m files where
it was possible, and seemed reasonable, to do so.
(In particular :
1) replace every [[NSTextView alloc] init] with [[GGTextView
alloc] init]
2) replace every method returning an NSTextView with one
returning an GGTextView.
)
Having done this, I get a project that builds without "incompatible
types" warnings
and runs fine, but unfortunately does not do what I want in some cases :
sometimes
a text view is of class NSTextView instead of GGTextView. My guess is that
this problem
comes from the only case where I could not apply rule 2), namely the method
- (NSTextView *)firstTextView {
return [[self layoutManager] firstTextView];
}
in Document.m. The stumbling block here is that, one way or another,
one has to "transform an NSTextView into a GGTextView." I tried to replace
the
code above with the following :
- (GGTextView *)firstTextView {
[GGTextView poseAsClass: [NSTextView class]];
return [[self layoutManager] firstTextView];
}
This produces a warning and a crash at runtime. What is the right way to
use posing
in this situation ? Should I leave all those NSTextViews alone and just
add the line
[GGTextView poseAsClass: [NSTextView class]];
in a piece of code that gets called early ?
Ewan
DATE : Sat Jul 22 19:36:26 2006
Hello all,
I created a subclass of NSTextView (called GGTextView) that differs
from its superclass only by the implementation of the
-pageFooter: method, and I'm trying to "replace
NSTextView with GGTextView everywhere" in the source code
for TextEdit, so that when the new version of TextEdit runs
only the new "-pageFooter:" method is called.
So I replaced NSTextView with GGTextView in the .h and .m files where
it was possible, and seemed reasonable, to do so.
(In particular :
1) replace every [[NSTextView alloc] init] with [[GGTextView
alloc] init]
2) replace every method returning an NSTextView with one
returning an GGTextView.
)
Having done this, I get a project that builds without "incompatible
types" warnings
and runs fine, but unfortunately does not do what I want in some cases :
sometimes
a text view is of class NSTextView instead of GGTextView. My guess is that
this problem
comes from the only case where I could not apply rule 2), namely the method
- (NSTextView *)firstTextView {
return [[self layoutManager] firstTextView];
}
in Document.m. The stumbling block here is that, one way or another,
one has to "transform an NSTextView into a GGTextView." I tried to replace
the
code above with the following :
- (GGTextView *)firstTextView {
[GGTextView poseAsClass: [NSTextView class]];
return [[self layoutManager] firstTextView];
}
This produces a warning and a crash at runtime. What is the right way to
use posing
in this situation ? Should I leave all those NSTextViews alone and just
add the line
[GGTextView poseAsClass: [NSTextView class]];
in a piece of code that gets called early ?
Ewan
| Related mails | Author | Date |
|---|---|---|
| No related mails found. | ||






Cocoa mail archive

