• 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
Still NSTextView custom insertion point
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Still NSTextView custom insertion point


  • Subject: Still NSTextView custom insertion point
  • From: "Thierry Passeron" <email@hidden>
  • Date: Sun, 19 Mar 2006 01:46:26 +0100

Dear fellow cocoa developers,

I'm still stuck with this problem of making a custom insertion point
in an NSTextView. Of course I can set the TextView to not display any
insertion point and then implement a timer that will do the job. But
I'm willing to understand why I can't do it the usual way like this:

@interface CommandTextView : NSTextView {

}

@end

@implementation CommandTextView

 - (void)drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color
turnedOn:(BOOL)flag
 {
       NSRect rectDumb=NSMakeRect(5,5,10,10);

   if( flag==YES )
       {
               [self lockFocus];
               [color set];
               NSRectFill(rectDumb);
               [self unlockFocus];
               return;
       }

               [self lockFocus];
               [self setNeedsDisplayInRect:rectDumb avoidAdditionalLayout:NO];
               [self unlockFocus];
}

- (void) updateInsertionPointStateAndRestartTimer: (BOOL)restartFlag {
       NSLog(@"update: flag=%d",restartFlag);
       [super updateInsertionPointStateAndRestartTimer:restartFlag];
}

@end

It works fine when you don't type any text, but, when you type some
text in the textview, the I-beam insertion point comes back from
nowhere ... I can't find where it comes from.
If you comment the [super updateInsertionPoint....] there won't be any
insertion point at all in the view. So I'm guessing this method is
mandatory. But what it does is a mistery to me.

Any of you have successfuly created a custom insertion point in an
NSTextView ? What do I need to do ?

Thanks in advance,

Best regards,

Thierry
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Still NSTextView custom insertion point
      • From: Greg Herlihy <email@hidden>
    • Re: Still NSTextView custom insertion point
      • From: Andreas Mayer <email@hidden>
  • Prev by Date: Re: classes in framework
  • Next by Date: Re: create NSMutableString with no limit?
  • Previous by thread: Re: classes in framework
  • Next by thread: Re: Still NSTextView custom insertion point
  • Index(es):
    • Date
    • Thread