I have tried many objects in Xcode's object library, but I can't seem to find the correct objects.
What I am trying to do is create a log for my app, for development purposes, but also for any future users who just feel like having a log. I don't want to use NSLog(NSString). I need an Obj-C equivalent of Java's javax.swing.JTextArea that has the following properties:
1. can be contained in a scroll pane (and how do I do this)
2. can be set to un-editable (Java equivalent of myTextArea.setEditable(false))
3. (in code) can receive \n as "new line" (shouldn't be a problem)
Does this exist, and if not, how can I create something similar (for example covering a text area with a layer)?
Thanks
Cocoa's NSTextView class fits this perfectly. It can be found in the object library as "text view". It can be set to non-editable in the properties inspector and can receive "\n" as a new line. It already has scroll bars.
Related
For a custom language I created a CompletionContributor. Everything works fine. But I'm limited to the information I can display (only in the list or the bottom "advertisement" and only 1 line).
When trying to auto-complete on a java class name it will display more information on the selected line in a small side window. I would like to exploit that mechanism but I really don't know how it is done.
When looking at the options provided, I can use a custom LookupElementRenderer but there is no method in LookupElementPresentation related to the right window.
Any idea how it is done?
Are you referring to documentation popup which may be displayed if the corresponding setting (Setting->Editor->General->Code completion->Show the documentation popup in) is turned on?
If you want the feature to work for your language you have to use lang.documentationProvider extension point.
So, since updating, the gui randomly hangs editing a xib file. The scenario goes like this:
click an object - i.e, array controller
expand a parameter, Filter Predicate here
Select target object in pull down
try to enter model key path - HANG
In different xib files, the hang comes when trying to enter the model key path textfield. I've also seen errors citing bogus fields like 'Hidden3' for some attribute bindings - only workaround was to remove them.
Has anyone ventured to editing the xml directly, but I guess I can do that in code :-(
Well, I know this is an old question, but I found an answer.
My situation was similar to the one described above: Xcode hanging whenever I edited the key path of any binding in Xcode 8.1. Nothing described here or elsewhere worked.
However, what did work was to edit the storyboard outside of the actual Xcode project: open the offending StoryBoard by itself, do not access it through the project.
This appears consistent with a Sample/Spindump through the Activity Monitor when Xcode hung that showed functions that appeared related to auto-completion/edition. Unchecking auto-completion did not work though (in Prefs).
CyLog’s WildRename is a good program for performing batch-renames on files. The problem with it is that while the main window is resizable, it does not have the maximize box which makes it a little frustrating to size and use. Moreover, they have not made any updates in a long time, so the program is essentially discontinued.
I ran WildRename and used WinSpy++ to modify the style of its window to manually include the WS_MINIMIZEBOX style and bam!, it was now functioning as expected.
The question now is how to make this permanent.
My first instinct was to fire up ResHacker, but the problem is that the style that needs to be modified is that of the main window of a non-dialog application, so ResHacker has no way of doing this.
The next thing I tried was to open it in a hex-editor, to find the address(es) of the string corresponding to the titlebar. I then opened the file in W32Dasm and located the address of the code that references the address of the titlebar string. I did all this in an attempt to find the location of where the main dialog is created so that I can modify the style passed to CreateWindow(). Unfortunately, I cannot find a call to CreateWindow anywhere near the reference to the titelbar string and none of the calls to CreateWindowEx that I can find seem to be (obviously) the ones used to create the main window.
Is there an easy/automated way of modifying the style of the main window (assuming a non-dialog application)?
You could use a debugger like OllyDBG to dump the exe memory after the edit with WinSpy++, then use that exe or compare the files to see where the change is if you want to see what you've missed
There has to be a call to CreateWindow/Ex(), especially if it not a dialog from a resource. You just need to look harder. I would use IDA instead of WinDasm. It will decompile the assembly into more understandable code, and it has a built-in debugger. You can put a breakpoint on the title string and see in real-time which code actually touches it, and then follow it back to the accessing code.
Whenever I'm like surfing on the web and I highlight a bunch of text, I see a "New TextWrangler Document with Selection" item on the contextual menu.
How do I replicate this functionality with my app so that whenever a user selects text in any other application, he can see a "New (My App) Document with Selection" item in the contextual menu and upon clicking on it, it feeds the selected text into my app?
Update
To try to answer my own question, I followed the sample code here: http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/SysServices/Articles/providing.html
which implements a simple rot13 encryption service on highlighted text. but it ain't working.
Although my "Encrypt Text" appears in the system preferences menu like "New TextWrangler Document with Selection" as shown above, it doesnt actually appear in an application's services menu or right-click contextual menu when text is selected.
Can someone tell me why the sample code in apple's documentation is not working
#PeterHosey here it is, with NSRequiredContext too:
my app name is called "simpleEncrypt" and the message is exactly the same as the one copied from apple's services implementation guide.
- (void)simpleEncrypt:(NSPasteboard *)pboard
userData:(NSString *)userData error:(NSString **)error;
In the Info.plist for my Translate Text application, I'm using NSStringPboardType as the send type for each of its services.
The system-declared UTIs list says that the modern equivalent to that is public.utf8-plain-text, so try changing your service's send and return types to that.
If it works, it'd probably be a good idea to list all the plain-text variants. Those are listed there in the Uniform Type Identifiers Reference; they're the types that conform to public.plain-text.
You need to include an NSRequiredContext dictionary in your service dictionary that describes when the service is appropriate to enable. Until you do, it is disabled in all contexts by default. (I'm not sure why it still doesn't show up even after you enabled it, but this is a required first step.)
I want to build a keyword/tag feature for my Cocoa application. Is there a tutorial or example of how a control that sets keywords/tags works? I want it to look something like the Keywords window in iPhoto that you get from Window->Show Keywords.
There is a built in control for this called NSTokenField, it's a simple subclass of a NSTextField. You supply a string and a set of delimiters and it automatically tokenizes them.