Scenario:
I am creating a user interface to assist in the renaming of a bunch of files. The goal is to ensure that each file ends up with a completely unique name. As each file is selected, a set of associated metadata fields are concatenated together to aid in compliance to new naming conventions. I call this the “derived” name.
A Panel window is presented with the “derived” file name, the “original” file name, and a Scroll View of all of the previously assigned file names.
The “derived” file name field is of the type “Search Field.”
The user can change the text in the Search Field and an attached predicate filters the Scroll View. If the text in the Search View matches a pre-existing value, a caution icon is shown and the “Apply” button is made inactive. Once the field contains a unique value, the icon is changed to a green light and the “Apply” button is made active.
This all works great except for a couple of instances.
A - When the Panel is first displayed, the derived value is inserted into the Search Field via setStringValue_()
B - If the user sees a file name in the Scroll View, they can double click on the row and its value is entered in the Search Field, again with setStringValue_(). The intention being that he/she will make minor additions in order to make it unique.
The problem is that in situations A and B, the predicate is not applied to filter the list since there was not a keystroke to invoke the predicate filtering.
I understand that I need to issue either a “textDidChange()” or “controlTextDidChange()” but I cannot seem to get the syntax to work.
SO, HERE IS WHERE THE REAL QUESTION COMES IN:
The Scroll View is assigned a Double Click Action via:
assignedFileNamesView's setDoubleAction_("assignedFileNamesDblClickEntry:")
This is the code executed upon the Double Click:
on assignedFileNamesDblClickEntry_(sender)
tell assignedFileNamesArrayController to set fr to selectedObjects() as record
assignedFileNameSearchField's setstringValue_(filename of fr)
-- [everything works fine up to this point]
assignedFileNameSearchField's controlTextDidChange_(WHAT OBJECT OR VALUE GOES HERE?)
end assignedFileNamesDblClickEntry_
If I need to instantiate my own controlTextDidChange_ function, what commands does it need to issue?
on controlTextDidChange_(aNotification)
– [WHAT DO I DO WITH THE NOTIFICATION?]
end controlTextDidChange_
FYI- Cocoa Configuration:
I have a Scroll View properly populated with three columns bound to the arrangedObjects of individual fields in an ArrayController which is populated by an Array read from a plist file.
The Search Field has its Search Predicate bound to the “assignedFileNamesArrayController”, controller key “filterPredicate” display name “FileName”, Predicate Format “FileName CONTAINS[cd] $value”