• 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
How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines)


  • Subject: How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines)
  • From: email@hidden
  • Date: Thu, 20 Jul 2006 18:59:21 +0200 (CEST)
  • Importance: Normal

        Hello all,

 I'm currently adding "sort lines" features to TextEdit (that is, I'm adding
some code in the TextEdit project in /Developer/Examples/AppKit). To this
end,
I created a subclass GGTextView of NSTextView that has those two
additional methods :

   -(IBAction) sortAlphabetically : (id) sender;
  -(IBAction) sortReverseAlphabetically : (id) sender;

  corresponding to two items I added to the main menu.
 After replacing NSTextView with GGTextView at the appropriate place, my
new app
works fine when in "Wrap to Window" mode, because in that situation the main
view is an NSTextView (and a GGTextView in my new version of TextEdit).

 In "Wrap to Page" mode, however, the main view is a MultiplePageView, whose
superclass is just NSView (as can be seen in MultiplePageView.h). Ideally
I should like
to define the two "sort" methods above on MultiplePageView also, but this
is impossible
because the implementation of those methods needs to know what lines are
selected,
and so uses methods like attributedSubstringFromRange: that are not available
for a NSView.

 I hoped that since I had connected my sort menu items in the nib file to
first-responder actions
and replaced about every occurrence of NSTextView in the source code with
GGTextView,
the sort feature would work automatically even in "Wrap to Page" mode. I
was wrong : at
runtime, the sort menu items are disabled when in "Wrap to Page" mode.

  Any suggestions on how to solve this problem ?

                                                                                           Ewan



 _______________________________________________
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: How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines)
      • From: Douglas Davidson <email@hidden>
  • Prev by Date: NSBrowserCell not extensible; need sample using NSButtonCell
  • Next by Date: Re: NSBrowserCell not extensible; need sample using NSButtonCell
  • Previous by thread: Re: NSBrowserCell not extensible; need sample using NSButtonCell
  • Next by thread: Re: How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines)
  • Index(es):
    • Date
    • Thread