Updating Align Left/Center/etc. for NSTextView

David Dunham dunham at mac.com
Fri Aug 3 23:17:17 PDT 2007


I'm doing something much like TextEdit, where I want to have a menu  
control text alignment. I want to place a checkmark (or a hyphen)  
next to the appropriate menu item(s) depending on whether the  
selected text is left aligned, centered, etc.

TextEdit doesn't do this. So I don't see an obvious way to do this.

To make things worse, I also want to update a toolbar icon (much like  
the one in NSRulerView) to also show alignment.

Any suggestions? The menu part is easy (I think), but I'm not sure  
how to efficiently track the selection changing. (Or am I worrying  
too much about observing every keystroke?)

David Dunham   www.pensee.com/dunham/
Imagination is more important than knowledge. -- Albert Einstein



More information about the MacOSX-dev mailing list