• 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
Re: TreeController and "selection" Binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: TreeController and "selection" Binding


  • Subject: Re: TreeController and "selection" Binding
  • From: Ken Thomases <email@hidden>
  • Date: Fri, 12 Feb 2016 23:57:45 -0600

On Feb 12, 2016, at 9:04 AM, Michael de Haan <email@hidden> wrote:
>
> The interface consists of 2 textViews and 1 outlineView. Lets call the one textView “source”, and the other “pattern”.
> The model represents regex matches found in the “source” textView by a regex in the “pattern” textView.
> The model is pretty straight forward, with properties, including one “range” property representing a “match”
> The outline view represents the model, after it is suitably parsed and implemented as an array.
> A tree controller is bound to the array, and the columns of the outline view, representing various aspects of the model, are bound through the tree controller. (There is a column for the “textual” match, a column for the position  and a column for the length of the match in the source.)
>
> Goal.  Highlight the matches in the source textview as the user selects a row in the outline View.
>
> Currently, it is  implement as follows.  Create an outlet for the tree controller, (in this case,  in my viewController). Here  the treeController’s selection.(in this case, range property) is programmatically bound  to a local variable, which uses the property observers of Swift ( willSet and newValue) to call a function which highlights the selected text in the “source”
>
> Ideally, I would like to omit the outlet/programmtically binding steps and bind the treeControllers selection in IB to my local variable. So, the “clunkiness” was a referral to the outlets and programmatic binding. However, I am unable to find a “selection” binding in IB that would make it possible.

Have you considered just implementing the outline view delegate method outlineViewSelectionDidChange() and, in there, using treeController.selectedObjects[i].range to highlight the matches in the source text view?  Bindings are great if they happen to make things easier/simpler, but sometimes it's easier/simpler to go another route.

Regards,
Ken


_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden


References: 
 >TreeController and "selection" Binding (From: Michael de Haan <email@hidden>)
 >Re: TreeController and "selection" Binding (From: Quincey Morris <email@hidden>)
 >Re: TreeController and "selection" Binding (From: Michael de Haan <email@hidden>)

  • Prev by Date: Re: Don't you hate it when Appkit crashes?
  • Next by Date: Re: Don't you hate it when Appkit crashes?
  • Previous by thread: Re: TreeController and "selection" Binding
  • Next by thread: Two Problems
  • Index(es):
    • Date
    • Thread