• 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: toggle new attribute in range of text (was : exponent action in NSTextView subclass)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: toggle new attribute in range of text (was : exponent action in NSTextView subclass)


  • Subject: Re: toggle new attribute in range of text (was : exponent action in NSTextView subclass)
  • From: Douglas Davidson <email@hidden>
  • Date: Thu, 22 Mar 2007 09:27:41 -0700


On Mar 21, 2007, at 11:39 PM, email@hidden wrote:

Yes, this deals at once with both typing attributes and attributes in a
selected text. However, if a user sets the typing attributes to
"exponential mode"
he will need to return to normal mode when he's done. As far as I can see,
your code does not provide this functionality. What is needed here is a
"toggle"
behaviour, like the "Bold" (or "Italics") menu item in TextEdit. But that
is much
more complicated to implement, is it not ? It amounts to adding a new kind
of attribute to ranges of text.

As with bold, italics, underline, etc., you would need to decide when to perform the action and when to perform the inverse action. For example, for the underline action the current criterion is that if there is a selection and the first character of the selected range has any form of underline on it, or if there is no selection and the typing attributes have any form of underline, then underline is removed; otherwise a single simple underline is added. You would probably want to add a line to your validateMenuItem: implementation to set the state of the menu item accordingly.


Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


References: 
 >toggle new attribute in range of text (was : exponent action in NSTextView subclass) (From: email@hidden)

  • Prev by Date: Drawing on Another App's CGDisplayCapture
  • Next by Date: Re: Drawing on Another App's CGDisplayCapture
  • Previous by thread: toggle new attribute in range of text (was : exponent action in NSTextView subclass)
  • Next by thread: Retained ivars being set to 0x0
  • Index(es):
    • Date
    • Thread