How can I receive keyboard input in Cocoa? - objective-c

I currently trying to create my own custom cocoa library for C to create a window. The only thing that is missing is getting input from the user and display it through NSText / NSView. I have looked at this but it has not helped me in any way to create an input box. Any help would be appreciated.

Related

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

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.

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

Programmatically create grid view

I am working on an app in which i am trying to implement something like this :-
1: First of all,i created a button(whose name here is "Create a new folder"). On clicking that button,an alertview will appear which will ask for the name of the button which is going to be created on click.
2: The above process will be repeated each and everytime when we click on "create a new folder" button.
3:The buttons which are created at runtime will be arranged in a grid view format.
Above shown screenshot will let you know about the required arrangement.
I've tried this by using UITableview and making columns in it. But i am not able to create folders at runtime.Please help me find any way to solve this. Suggestions will be highly appreciated. Thanks in advance.
Try UICollectionView if you can require iOS 6. There is a simple Guide on Apple's site too.

How to dynamically add fields to a NSView similar to iCal New Task popup?

I'm trying to implement a NSView which will host a 'choose file' attachment button. If the user chooses to add a file, the user will be given an option to add another one (and from the 'new set of dropdowns' the user will essentially be able to pick the kind of file they're attaching').
The closest match to this functionality is iCal's New Task editor where you select an alarm and then it gives you an option to add another alarm right underneath.
What is the right way of doing this (I'm new to Mac OS X development)? I originally thought I'd create a custom NSView with all the 'file options' and then if the user was to attach a file I'd dynamically add another NSView right below it (in a NSScrollView). However so many apps do something similar that I almost feel as if there's something else out there in the set of controls that I should be using.
Please can someone guide me to the right direction? Is 'NSForm' or NSPredicateEditor used for this sort of stuff? This is what I mean:
Neither NSForm nor NSPredicateEditor would be useful for what you want to do. I think your thoughts about how to do this by adding a custom view below the original view, is the right way to go. You don't necessarily have to do it in a scroll view, you could expand the size of the window like iCal does.

Search and replace pop down in Obj-C app

Hi all I just wanted to know if anyone could point me to a link or show me how to implement a search & replace like in TextEdit 1.7 on Lion, or in Xcode 3.2 (when you click on CMD + F). There is a little pop down that appears and I would very much like to implement a similar search field.
Thanks in advance!
"An NSSearchField object implements a text field control that is optimized for performing text-based searches. The control provides a customized text field for entering search data, a search button, a cancel button, and a pop-up icon menu for listing recent search strings and custom search categories." NSSearchField class reference.