ftp.nice.ch/pub/next/developer/resources/classes/UHInspector.1.2.N.bs.tar.gz#/UHInspector_1.2/InspectorMultiDemo/MultiDemo.m

This is MultiDemo.m in view mode; [Download] [Up]

#import "MultiDemo.h"
#import "UHInspectorManager.h"
#import "UHInspector.h"
#import "Resistor.h"

@implementation MultiDemo

- init
{
	[super init];
	
	selection=[[List alloc] initCount:4];	//object selection list
	
	/* First get the inspector manager, which will load its own nib. */
	inspectorManager=[[UHInspectorManager alloc] init];
	[inspectorManager setDelegate:self];	//this object will get notifications
	[inspectorManager enableDoubleInspector:NO];
	
	/* Now get the objects to be inspected for this MultiDemo. Not all inspectable objects
		must respond to setLabel:, but I know that these do. */
	/* Resistor is different from the others in these demos in that each instance returns
		its unique label when it receives the getLabelForInspector message.  Thus each
		resistor instance is inspected separately. */
	[selection addObject:[[[Resistor alloc] init] setLabel:"Resistor 1"]];
	[selection addObject:[[[Resistor alloc] init] setLabel:"Resistor 2"]];
	[selection addObject:[[[Resistor alloc] init] setLabel:"Resistor 3"]];
	[selection addObject:[[[Resistor alloc] init] setLabel:"Resistor 4"]];
	
	return self;
}

- appDidInit:sender
{
	/* Now give the list one time to the inspector manager. */
	[inspectorManager inspectList:selection requestor:self];
	return self;
}

/* Message to delegate from UHInspectorManager when inspector is changed in inspector manager. */
- inspectorChanged:sender
{
	sprintf(buf,"Object selected is %s.",[[[sender currentInspector] object] label]);
	[delegateMsgField setStringValue:buf];
	sprintf(buf,"Current selection on popup list is %s.",[sender currentInspectorLabel]);
	[inspectorLabelField setStringValue:buf];
	return self;
}

/* Inspector panel must be explicityl ordered front. */
- showInspector:sender
{
	[inspectorManager showInspector:self];
    return self;
}


@end

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