Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!jarthur!nntp-server.caltech.edu!jjfeiler From: jjfeiler@nntp-server.caltech.edu (John Jay Feiler) Newsgroups: comp.sys.next Subject: Re: Help, please, on making connections in IB Message-ID: <1991Apr19.180648.28484@nntp-server.caltech.edu> Date: 19 Apr 91 18:06:48 GMT References: <2524@fornax.UUCP> Distribution: na Organization: California Institute of Technology, Pasadena Lines: 57 This fouled me up for a few days, and may be of some interest to others, so I decided to post this... mcdonald@fornax.UUCP (Ken Mcdonald) writes: >I'm having a few problems defining and sending action messages in >Interface Builder, and hope that some kind soul might be able to give >me some advice. >First, I'd like to use a subclass of the "TextField" class, which I call >"EntryField"; an EntryField object is defined to respond to one additional >action message (besides those defined by a standard text field), called >"update". The idea is that the user enters data into this text field, >then presses a button to tell the application that the data in said >text field is what they want; the button sends an "update" message to the >EntryField object, which in turn sends an action message to the application >informing it of the presence of new data in the field. This may be a bit >klugey, but that's OK--this is just a prototype. >The first problem is that I can't even create an object of class EntryField >in Interface Builder. The class definition is no problem, but I can find >no way to specify that a normal TextField should actually be of type >EntryField, and when I try to Instantiate an EntryField object from the >Classes window, the Instantiate pulldown menu entry is disabled whenever >EntryField is the selected class. So, having defined an EntryField class, >how do I create an object of this class in Interface Builder, so as to >make connections to and from it? You need to drag a customview object to the palette with all the buttons onto your window, then tell IB that it is of class EntryField. As far as I've been able to tell, this is the easiest (and perhaps the only) way to instantiate a subclass of View. (it actually makes a lot of sense in retrospect, but I couldn't figure this out for days....) >My other question is very similar. The application itself will be an >object of type "MyApp", which is a subclass of the Application class, with >some extra action messages and so forth. Again, I can find no way to create >or refer to this object in Interface Builder; so there is no way, for >example, that I can tell my EntryField object that it should send a >"newData:" message to the application, in response to the "update:" message >it just received. After you've created the class description and parsed it, go to the instantiate menu item on the popup list in the class inspector window. This will create and object in the window where the sound suitcase and stuff is, and it will be called MyAppInstance. Rename it if you wish, and you can now drag connections from the icon representing this instancce of the class to anything else in the App. >This seems so simple that I'm sure I must be missing something. Any advice >is most welcome, as without it, I can't even get started on this project. >Thanks in advance, >Ken McDonald >{mcdonald@cs.sfu.ca} >. John Feiler