Custom Controls and Controllers
Custom Controls and Controllers
- Subject: Custom Controls and Controllers
- From: Simon Parkinson-Bates <email@hidden>
- Date: Tue, 29 Oct 2002 16:15:43 +1100
Hi There,
I'm a recent convert to the Mac after having been developing for the past 7
years on Windows. First off, here is the situation so far:
I have created a custom control in IB and generated the following class
(note: a lot of stuff removed for clarity)
@interface DVBitManipulator : NSControl
{
// .. some member variables.
}
// various methods...
-(void)mouseDragged:(NSEvent*)theEvent;
-(void)mouseDown:(NSEvent *)theEvent;
#end
As you can see I've implemented the mouseDragged and mouseDown methods.
I've also created for myself a controller class which has been
auto-generated for me by IB (note: a lot of stuff removed for clarity).
@interface DVBitController : NSObject
{
IBOutlet DVBitManipulator *bitManipulator;
}
- (IBAction)onBitManipulator:(id)sender;
end;
As you can see I've created both an outlet and an action in this controller,
(Ctrl dragged from my custom control "DVBitManipulator" to an instance of
"DVBitmanipulator" and visa versa).
The problem is this... I want to get the mouse events handled by my
sub-class DVBitManipulator to also fire the onBitManipulator method in my
DVBitController instance. How is this done? What code is required in the
mouseDragged and mouseDown events?
-(void)mouseDragged:(NSEvent*)theEvent
{
// doing some stuff....
// what do I need to call here to get my application instance of
// DVBitController to execute onBitManipulator method?
}
-(void)mouseDown:(NSEvent *)theEvent
{
// doing some stuff....
// what do I need to call here to get my application instance of
// DVBitController to execute onBitManipulator method?
}
From what I can tell so far, I've got to call "[self sendAction:<??????>
To:nil]" is this correct? If so, what do I replace <??????> with?
I want to do this so I can talk via the Controller to other elements in my
GUI?
cheers
Simon.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.