I believe that method comes from the "CommandLineTool" plug-in example in Xcode.

Julien


On 25 Aug 2008, at 20:38, Ian Grant wrote:

Thanks Marco,

It was even slightly more straightforward than your suggestion:

I bound the NSStepper and textField to plugIn.argumentCount

Had:

@property NSUInteger argumentCount;
and a matching ivar

Added your method (I'd like to know what docs/example that was in - can't find it anywhere. It is much cleaner than my way of doing it!). I guess that method over-rides the one generated with @synthesize argumentCount; so no other methods needed - the binding takes care of the rest. When the bound value changes the accessor seems to be observing it so, it just works.

Thanks very much.

Regards, Ian
*******************************
Ian Grant
Senior Lecturer in Digital Art
Faculty of the Arts
Thames Valley University
Ealing, UK
W5 5DX
<[EMAIL PROTECTED]>
*******************************



On 25 Aug 2008, at 10:34, Marco Masser wrote:

I have subclassed QCPlugInViewController to handle the IBAction I called amendStrings that adds, removes in increments in response to NSStepper and when the textfield is manually edited.

The subclass of QCPlugInViewController looks like this:

@interface UITestPlugInViewController : QCPlugInViewController
{
        
        int currentStringCount;
        int previousStringCount;
        int diff;
        
        BOOL raisedFlag;
        BOOL loweredFlag;
        BOOL firstCall;

}

- (IBAction) amendStrings:(id)sender;
@end

I am wondering: do I need to subclass QCPlugInViewController at all?
Should the ivars (the ints) be dynamic properties of qcplugin? and are therefore 'serialised' when the patch is copied?

You should not have to create an QCPluginViewController subclass. You also don't really need to store all the view controllers in an array unless you really need them. And you probably won't. Just take the NIB file provided by the Xcode template (assuming you started your patch using the right Xcode template) and hook up all the bindings just the way you did. Then, implement a custom - setNoOfStrings: method which saves the new count into the ivar and then calls the following method (I didn't write that one myself, it probably comes from the docs...):

- (void) setArgumentCount:(NSUInteger)newCount {
        NSUInteger i, currentCount = self.argumentCount;
        /* Update argument input ports */
        if(newCount > currentCount) {
                for(i = currentCount; i < newCount; ++i)
                        [self addInputPortWithType:QCPortTypeString
                                                                forKey:[NSString 
stringWithFormat:@"argument_%i", i]
withAttributes:[NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"Argument #%i", i + 1] forKey:QCPortAttributeNameKey]];
        }
        else if(newCount < currentCount) {
                for(i = newCount; i < currentCount; ++i)
[self removeInputPortForKey:[NSString stringWithFormat:@"argument_%i", i]];
        }
        
        /* Save new argument count */
        argumentCount = newCount;
}

This should get you going. Please forgive me if this isn't everything you need to get going, I didn't read all your code just now : )

Marco
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/ian.grant%40mac.com

This email sent to [EMAIL PROTECTED]


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list ([email protected] )
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/julrigal%40gmail.com

This email sent to [EMAIL PROTECTED]

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to