• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Not able to place the cursor at required character index in mytextview(subclass of NSTextView).
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Not able to place the cursor at required character index in mytextview(subclass of NSTextView). (From: ayyapu <email@hidden>)

  • Prev by Date: [OT] Algebra (was: Re: Is Concatenation that complex?)
  • Next by Date: Getting a command key before it is interpreted by the menus
  • Previous by thread: Not able to place the cursor at required character index in mytextview(subclass of NSTextView).
  • Next by thread: C function to a Selector ?
  • Index(es):
    • Date
    • Thread