ftp.nice.ch/peanuts/GeneralData/Usenet/news/1991/CSNProg-91.tar.gz#/comp-sys-next-programmer/1991/Sep/Method-Forwarding

This is Method-Forwarding in view mode; [Up]


Date: Sun 22-Sep-1991 20:04:57 From: gregor@oit.itd.umich.edu (Gregor Purdy) Subject: Method Forwarding Let's say I'm keeping a List of Window IDs. Now, all these windows have a special type of View subclass in them (I created them that way). I'd like to send messages to the window that it forwards on to the view. The methods are not defined in the windows. Is this possible, or do I have to do: [[myWindow contentView] methodName]; ??? I don't want to subclass Window, or make a catagory. The above wouldn't be too bad, but I'd like to just do [myWindow methodName]; and have it forwarded.
Date: Sun 23-Sep-1991 13:24:17 From: absinthe@hardy.u.washington.edu (Daniel Faken) Subject: Re: Method Forwarding In article <1991Sep22.200457.7169@terminator.cc.umich.edu> gregor@oit.itd.umich.edu (Gregor Purdy) writes: >Let's say I'm keeping a List of Window IDs. Now, all these windows have a >special type of View subclass in them (I created them that way). I'd like to >send messages to the window that it forwards on to the view. The methods are >not defined in the windows. Is this possible, or do I have to do: > [[myWindow contentView] methodName]; >??? > >I don't want to subclass Window, or make a catagory. The above wouldn't be too >bad, but I'd like to just do > [myWindow methodName]; >and have it forwarded. What you mean is you don't want to change the Window class, yet you want it to do something it currently can't.... Not possible! If you really want 'forwarding,' just subclass the forward method.. Otherwise, just make a trivial category such as: #import <objc/Object.h> @interface Window(ViewWindow) - doXMethod; @end @implementation Window(ViewWindow) - doXMethod { [contentView doXMethod]; return self;} @end As I said, however, this is not "real" forwarding, and will only forward one message. Just look up 'forward::' in the docs, and it shalleth glowen and lead you to true forwarding.. :) absinthe@u.washington.edu ==> Daniel Faken NeXTMail welcomed with open arms and soft palms
Date: Sun 23-Sep-1991 18:06:00 From: liberte@ncsa.uiuc.edu (Daniel LaLiberte) Subject: Re: Method Forwarding <1991Sep23.132417.4674@milton.u.washington.edu> >I don't want to subclass Window, or make a catagory. The above > wouldn't be too bad, but I'd like to just do > [myWindow methodName]; Windows can also have delegates. I believe if a message is not understood by the window, it is automatically forwarded to the delegate. So maybe you can set the window's delegate to your content view to do exactly what you want. Sorry if this is misinformation - I dont have the manuals handy. Dan LaLiberte National Center for Supercomputing Applications liberte@ncsa.uiuc.edu (Join the League for Programming Freedom: league@prep.ai.mit.edu)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Marcel Waldvogel and Netfuture.ch.