Re: Not able to place the cursor at required character index in mytextview(subclass of NSTextView).
Re: Not able to place the cursor at required character index in mytextview(subclass of NSTextView).
- Subject: Re: Not able to place the cursor at required character index in mytextview(subclass of NSTextView).
- From: Kay Roepke <email@hidden>
- Date: Fri, 23 Apr 2004 16:21:20 +0200
On 23. Apr 2004, at 15:28 Uhr, ayyapu wrote:
>
Hi,
>
>
I am not able to place the cursor at required character index in
>
mytextview(subclass of NSTextView).
>
>
Actually i am overriding the mouseDown:, mouseDragged: and mouseUp:
>
methods. If I send the mouseDown: event to super, i am able to do
>
that, but subsequent mouseDragged: and mouseUp: methods are not
>
getting called.
>
>
Is there any way to get those subsequent mouseDragged: and mouseUp:
>
methods or place the cursor at desired location?
mouseDown: of the super class is actually grabbing all the mousedrag
events from the event queue. I ran into that problem
a couple of weeks ago, too. Search for "draggable tab view" at
cocoa.mamasam.com.
Here's part of the (private) reply I got, and the solution to your
problem. Notice that you will probably lose the default
implementation for dragging in the textview. Consider that if you muck
with EventRrackingRunLoops.
Kay
- (void)mouseDown:(NSEvent *)theEvent
{
NSEvent *nextEvent = [[self window]
nextEventMatchingMask:NSLeftMouseDraggedMask|NSLeftMouseUpMask
untilDate:[NSDate distantFuture] // or perhaps some reasonable
time-out
inMode:NSEventTrackingRunLoopMode
dequeue:NO]; // don't dequeue in case it's not a drag
if ([nextEvent type] == NSLeftMouseDragged) {
// initiate your drag
} else {
[super mouseDown:theEvent];
}
}
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
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.