Note that there are some explanatory texts on larger screens.

plurals
  1. POModify multiple NSTextView with commands
    text
    copied!<p>I'm wondering if anyone knows if it is possible to modify multiple NSTextViews with a menu bar command. For example if the user selects "Bold" from the menu bar, the different NSTextViews that are selected update all their content to show bold.</p> <p>Here is the set up I have:</p> <pre><code>@interface MyCustomTextField : NSView &lt;NSTextViewDelegate&gt;{ NSTextView *textView; BOOL selected; ... } </code></pre> <p>So basically I have my own custom class and within each custom class I have a NSTextView, a var determining whether or not this view is selected and some other stuff. </p> <p>I'm able to select multiple fields however from what I've read on Apple documentation every NSTextView in the window shares one field editor. When a user edits a NSTextView they are actually sending commands to the field editor which processes it and routes it to NSTextView. If this is the case does that mean that I need to create my own custom field editor and route the commands to all my custom selected text classes instead?</p> <p>==<strong>edit</strong>==<br/> My CustomTextField classes have a variable named "selected" (see above) and by holding the shift or apple key down I'm able to "select" multiple CustomTextField instances (I put a mask in front of the NSTextView instances which catches the mouseDown message). </p> <p>So by this selection, multiple instances have their "selected" attribute set to true. As far as the first responder for the window, it would be set to the mask that shows the blue halo around all the NSTextViews. </p> <p>I'm wondering if I can tell the app to accept default NSTextView commands (such as bold, italicize, etc.) and that if I supply a custom field editor, it will pass all the appropriate messages to the selected CustomTextFields which will then pass it on to the NSTextViews.</p> <p>In my head the message would be passed like this:<br/></p> <p><strong>User Submits Text Toolbar Command</strong> > <strong>Custom Field Editor</strong> > <strong>MyCustomTextField</strong> > <strong>NSTextView</strong> </p> <p>Hopefully my explanation made sense or maybe I'm in LaLa land now.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload