Objective C: Pass Result from Popup Window Back To Calling Class - objective-c

I'm writing a very simple Mac OS app to parse a text only video EDL (edit decision list) and pull out locators (or 'markers' if you're familiar with Apple's FCP nomenclature) and add them to a new NSMutableArray to be displayed in an NSTableView.
All of this works perfectly, resulting in something similar to the following image for my test EDL:
My ultimate goal is to further process this list and reduce it to only those markers which contain a video effect (VFX) name. Those are the RED markers in my sample. I want to be able to open a very simple pop-up window asking which color represents the VFX (again, RED in this case) so I can simply iterate thru the array and print those locators only.
I've created a new window and window controller to open the following window:
This works great, and I can use an NSLog within my new window controller class to display my typed responses.
The question then is: how do I pass my typed response back to my calling class, and then execute a new method to use this response for further processing of my array?
As it is now, when I hit the 'OK' button, it executes a method (in my new window controller class) which assigns the text in my NSTextField to a new NSString. But how can I then ALSO pass that variable back AND execute another method in the original calling class which holds my EDL array?
I'm sorry for the newbie question, and I'm not asking somebody to actually write code for me, but I don't even know what to look for in the manuals to study up on this. I'm a video editor first and a coder only as a hobby, so go easy on me please.
Thank you, btw, to Phillip Mills for helping me get as far as I have with the TableView.

Related

How do we run a pharo program without instantiating an object in the playground?

I wrote a Pharo program that generates my daily task non-stop.
The program itself works fine, however I always need to instantiate my object in the playground to run it. Is there some other way of doing it automatically without having to create an object and send a message to it?
Yes, you can. Save the image after you have instantiated your application and closed everything else. Then just start pharo from the image and you will have your application started.
If you want to do it more production wise you could use pharo-launcher.
For more detailed information you could squeak wiki which you can adjust to Pharo.
I would do one of three thing here:
Add an item to the World menu, so you can bring up the menu and select your task. See a Stackoverflow Answer on that same topic.
You could write some triggering code in a .st file on your file system, then use StartupPreferencesLoader to load it on startup.
Create a window morph with a button that, once pressed, runs your code. Open the window, quit and save image changes. Never close the window.

How to create a file in a mac app

I am new to programming mac apps in Objective-C and need help with this. When I control click and drag to first responder from a button it brings up a box from which you can select some predefined functions that run when the button is clicked. On of the functions says newDocument. I was wondering if this means that it creates a new document (file) and if so how to actually make it create the file. I tried selecting newDocument but when I ran the app it said this: 2016-03-16 15:39:57.889 Test[26619:4382721] The (null) type doesn't map to any NSDocumentClass. My button is simply named create file and has no code attached to it, only the predefined function.
The method you are seeing, newDocument, is part of the Document Architecture. If you wish to use it you need to study the documentation, the particular function newDocument creates a "document" within your app along with an associated "window" rather than a "file" per se.
It sounds like you really need to read the Cocoa Event Handling Guide to learn how to handle a mouse event, and the File System Programming Guide to learn how to read & write files.
HTH

How to return NSLocalizedString as write in the code

Is there a way to get a NSLocalizedString in its untranslated states, for example getting it from a NSTexfield/label or popup button as below:
_mylabel.stringValue
or
[_myPopupButton titleOfSelectedItem];
Obviously returns a translated string depending on the current OS language.
This is inconvenient if I want to know and use a statement comparing what I find at the time, whereas users can also translate or adjust to their liking the stringsfile.
Any suggestion or workaround?
Initially the problem was that I used "NSUserDefaults standardUserDefaults" to save what was on the buttons on a plist, so when I restart the app would have taken those descriptions initially were created using simple strings if the plist did not contain all the dictionary needed (to return into my button), as if app was open for the first time).
It's enough to localize everything, even when re-reading or create the "empty" settings, so it does not matter if the preferences are written in another language: my button now return what the app found on the plist created by "NSUserDefaults standardUserDefaults"!
(sorry for my poor English)

How do I navigate through a method call hierarchy in Xcode 4?

I come from Eclipse, I would like to know if there is a way in Xcode 4 to navigate through method calls like there.
I know I can jump to the definition of a method, but I want to know who is calling that method/function.
The only way I've found is doing a regular text search, but that's not very helpful.
Since Xcode 4.4 the feature to look up the immediate caller and/or callees of a method has been available. Unfortunately, there doesn't seem to be a handy hierarchy view as there is in Eclipse.
What's New in Xcode 4.4
Xcode can show the callers and callees of the current function or method. This function is accessed from the Show Related Items menu, or by using the Assistant editor and selecting Callers or Callees in the jump bar pop-up menu.
here is a visual how to find the caller(s). Look for the little image i've highlighted in pink.
Doing a search is indeed the only way to check where in the code certain messages are being sent. Xcode doesn't have such a functionality. Keep in mind that even if it had, it couldn't be perfect because messages can be composed and sent dynamically at runtime.

Alternative to NSCollectionView in pre-OSX10.5, Cocotron?

NSCollectionView was introduced in OS X 10.5, and is not yet implemented in Cocotron.
I am trying to implement a small app that will allow creating properly packaged data files for an online service, which will then be uploaded by an administrator. More specifically, the user will create a collection of input and output data pairs, by dragging input and output files onto the window.
Currently the idea is that user drags a file, from the filename it's detected if it's the input or output filename (by default, input), and a view with icon and filename for input and output is added to collection view. Then, the second file is dropped on the "other" icon.
However, NSCollectionView does not appear in pre-10.5, and most of my users don't have Macs so I'll have to provide a Cocotron-built application. Not only that; I still don't fully understand KVC/KVO, and I really should understand everything that my code does. Hence, I need an alternative to NSCollectionView.
What alternative do I have to using NSCollectionView? (Any intuitive solution is appreciated, don't feel limited by the above description of my idea.)
To work with NSCollectionView, you need to not only understand KVC and KVO, but also Bindings.
There's code for an NSCollectionView clone that works on Tiger here.
I still don't fully understand KVC/KVO…
That's what the docs are for:
Key-Value Coding Programming Guide
Key-Value Observing Programming Guide
What alternative do I have to using NSCollectionView?
Make your own.