From: wave@waits.media.mit.edu (Michael B. Johnson)
Subject: Re: Custom IB Palette object mushed together from boxed control objects
Organization: MIT Media Laboratory
Date: Tue, 12 Jan 1993 12:36:17 GMT

Joseph Goldstone writes
> Probably the error here is in my conception of how IB works, but...
> 
> I want to agglutinate several standard UI objects (four TextFields and a  
> one-element Matrix of SliderCells) into a new UI object, and have that object  
> on a palette.  The Textfields serve to label the slider, indicate the  
slider's  
> min and max values, and display the slider's current numeric value as text.
> 
> Because I plan on using an awful lot of these (for a 3DKit camera settings  
> interpolation program) I wanted to
>   1) for N labelled sliders have N outlets in my App's distributor object,  
not  
> 5*N
>   2) have each labelled slider accept messages to set and get current values  
> and to set and get the labelled slider's min and max values
>   3) put these thangs on a palette so that I could re-use them in other  
> programs (I've wanted this functionality before)
> 
> Straightforward enough to create a Palette project, and in the new Palette  
> window align things as I liked and Group them into a Box object.  But IB only  
> lets you drag things into windows that happen to be subclasses of View (even  
> though they can have extra baggage on their shoulders, witness the  
ProgressView  
> in the Palettes tutorial being grouped within a box - the box gets dragged  
into  
> any new App's window along with the ProgressView itself).
> 
> But how to indicate that the group of objects comprising this box are part of  
> the new class I'm defining?  I can whip up a class definition pretty readily  
in  
> Edit that contains id pointers to the five enclosed objects, and parse it;  
but  
> only a dragged-in custom view will let you replace its type (or rather,  
specify  
> with which type it will later be replaced) in IB's attributes inspector, so  
> this newly-parsed class definition does me no good.
> 
> I suppose I'd be happy if I could figure out how to reparent the controls  
that  
> I'd grouped into the Box as subviews of my custom View, and to set the id  
> pointers in the custom View's object to those controls.
> 
> Sure, I could assemble the controls inside the object programmatically, but  
if  
> this is the only way, then I'm appalled at IB.  I can't believe that the  
> distance from simple object to compound is as great as the distance between  
> interactive construction of user interfaces from UI object palettes, and  
using  
> Edit to create C code that manually instantiates UI objects.
> 
> Can someone point out my more obvious conceptual problems here, so I can move  
> on from thinking about sliders to thinking about shaders?  :)
> 
> -- joseph

I just whipped up a little example that does this.  I've sent it off to Joseph,  
but if anyone else wants it, let me know and I'll NeXTMail it to you.  


--

-->  Michael B. Johnson
-->  MIT Media Lab      --  Computer Graphics & Animation Group
-->  (617) 253-0663     --  wave@media-lab.media.mit.edu
-->  NeXT Mail accepted at  wave@nordine.media.mit.edu
Newsgroups: comp.sys.next.programmer