• 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
odd drawInsertionPointInRect behavior
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

odd drawInsertionPointInRect behavior


  • Subject: odd drawInsertionPointInRect behavior
  • From: David Young <email@hidden>
  • Date: Tue, 16 Aug 2016 21:31:07 -0500
  • Mail-followup-to: email@hidden

I'm trying to draw my own NSTextView cursor.  I expect that for each
pulse of the cursor, drawInsertionPointInRect(_:color:turnedOn:) will be
called twice, once with turnedOn == true and, shortly afterward, again
with turnedOn == false.

Instead, my method overriding drawInsertionPointInRect is called once
per pulse.  Each time it is called, turnedOn is true.  Here is my
override method:

override func drawInsertionPointInRect(rect: NSRect, color: NSColor,
    turnedOn: Bool) {
	let lctx = alwaysOnOutlet.enter(#function)
	defer {
		lctx.exit()
	}
	lctx.print("... rect \(rect) turnedOn \(turnedOn)")
	super.drawInsertionPointInRect(rect, color: color, turnedOn: turnedOn)
}

(The lctx bits are just my instrumentation.  They boil down to a couple
of Swift.print() calls.)

Here and there on the web, people describe a strategy for actually
clearing the cursor when turnedOn == false.  For example,
http://stackoverflow.com/questions/15647874 . They mention
that it's also necessary to override an undocumented function,
_drawInsertionPointInRect.  I haven't found any mention that turnedOn is
always true.

Am I wrong in my expectation that drawInsertionPointInRect should be
called sometimes with turnedOn == false?  Does anybody else see the
behavior I describe?

Dave

--
David Young         //\ Trestle Technology Consulting
(217) 721-9981      Urbana, IL   http://trestle.tech/
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: odd drawInsertionPointInRect behavior
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Justification of collection cells in sections
  • Next by Date: Re: Justification of collection cells in sections
  • Previous by thread: Re: array = [NSArray new] or array = [NSArray array]?
  • Next by thread: Re: odd drawInsertionPointInRect behavior
  • Index(es):
    • Date
    • Thread