Skip navigation.
 
mlRe: How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines)
FROM : Douglas Davidson
DATE : Thu Jul 20 20:15:46 2006

On Jul 20, 2006, at 9:59 AM, <email_removed> wrote:

>  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.
>


I don't know offhand why it wouldn't work; quite a few standard menu 
items go to first responder actions defined on NSTextView.  Try 
investigating how everything is set up in your app; for example, take 
a look at your validation code, and see if that's being hit.

Incidentally, sorting of text lines is something that might 
reasonably be handled by a service, so that it would be available to 
all applications, rather than by custom application-specific code.

Douglas Davidson

Related mailsAuthorDate
mlHow do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines) delanoy Jul 20, 18:59
mlRe: How do you use NSTextView methods on a NSView ? (keywords: TextEdit, sort lines) Douglas Davidson Jul 20, 20:15