On Jul 23, 2013, at 9:33 AM, [email protected] wrote: > > On Jul 23, 2013, at 9:30 AM, Ken Thomases <[email protected]> wrote: > >> On Jul 22, 2013, at 7:22 PM, Gordon Apple wrote: >> >>> Thanks for the direct reply. The summaries are few and far between, >>> possibly a result of the dev-site outage. >>> >>> My speculation had to do with the highlighting I am trying to do. I >>> currently support setting the background color of selected text. However, I >>> would like to have the equivalent of a highlight pen, where the user selects >>> a highlight color and then drags across the text. I cache the current >>> selection highlight color, then change the selection highlight to the chosen >>> color. The intent (not completely implemented yet) is, on mouseUp, to then >>> set the background color, deselect the text, and restore normal >>> highlighting. I have created an augmented iBeam cursor (including a color >>> patch), but have had difficulty getting the text cursor to switch from the >>> iBeam to mine. >>> >>> I was thinking that, if markedText worked the way I was speculating, maybe >>> it would be a way to do the pen highlighting, and also allow all markings to >>> be easily cleared for the entire text view, if desired. Thus, my other >>> questions. >> >> I don't think you should attempt to use marked text for this purpose. >> >> Your code would not normally control which text is marked. This is normally >> controlled by Cocoa and/or the input method. The text view implements the >> methods of the NSTextInputClient protocol and through those methods, the >> framework tells it which text should be marked and when the marking should >> be cleared. >> >> Regards, >> Ken >> > I'm in agreement here. > You'll be better off to create a custom attributed string attribute if really > necessary for design. That would enable you to quickly identify the ranges of > your highlighter. Specifically, read more in the section: Text Editing of the doc Cocoa Text Architecture Guide _______________________________________________
Cocoa-dev mailing list ([email protected]) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
