Search results

  1. A

    Converting NSImageRep to NSImage?

    Have you tried this? NSImage * image = [[NSImage alloc] initWithSize:[imageRep size]]; [image addRepresentation: imageRep];
  2. A

    OpenGL using c/c++ in Mac OS X

    gcc -framework OpenGL -framework GLUT -lobjc main.c
  3. A

    OpenGL using c/c++ in Mac OS X

    When you compile from the terminal, you have to add -framework OpenGL to your linker flags.
  4. A

    can panther do something like this?

    Use osascript to run applescripts, particularly one including the 'display dialog' command.
  5. A

    NSString stringWithFormat:@"%15.2f", X

    The quick and dirty way is to drag an NSNumberFormatter from the palette in IB into the Classes area of your nib, then connect the text field's formatter outlet to it. Then instead of using setStringValue, you can do [readout setDoubleValue:X]
  6. A

    Blocking

    From what I could glean through the Apple Developer Documentation and a few Google searches, no such functionality exists. The general solution is to check each file for modification each time the application reactivates, since it is presumed that a user would be changing files around only...
  7. A

    Copy an object?

    If it's a Cocoa object, you can make a copy with [myObject copy]. If it's your own custom object, you have to implement its method -(id) copyWithZone:(NSZone *)zone before you can use [myObject copy]. The default behavior of -copy is to call -copyWithZone: so you don't need to override -copy...
  8. A

    Objective C/Cocoa - document needs to get info from a data source - how?

    Setting up the tabbing order is fairly easy. Connect the 'nextKeyView' outlet of each field to the field that should follow it in the order. It's also advisable to link in buttons and other interface elements, so that Full Keyboard Access users can access them. They will be skipped if FKA is...
  9. A

    Objective C/Cocoa - document needs to get info from a data source - how?

    You shouldn't move any of that to your window controller object. Its job should be to create and manage windows for the document, nothing more. If it needs data that the document maintains, it should query the document for it via accessors whenever it is needed, rather than having to go about...
  10. A

    Objective C/Cocoa - document needs to get info from a data source - how?

    Instead of maintaining two separate arrays for each of your document and your data source, why not instead have your data source query the document for its array whenever it is needed? You can make the connection between the two objects in Interface Builder. If you've got it set up right, the...
  11. A

    need sample - trapping a click in a nstableview

    I have no sample code, but this is an easy problem. You must set an object as the tableview's delegate, and you must implement this method on the delegate. - (void) tableViewSelectionDidChange:(NSNotification *)note
  12. A

    Help making a Pure Java app..

    Xcode provides a means to manage projects more complex than one or two source files, and aggregate products such as applications which include bundle resources, localized text, and other nifty stuff that makes OS X great. An Xcode project requires 'targets' which tell it how to compile and...
  13. A

    Sorting techniques

    Many Cocoa objects such as NSString and NSValue implement the compare: method, which does the same -1/0/1 thing as slur described. You can use this with sortedArrayUsingSelector: to sort an array of such objects. You can also implement compare: on your own classes to make them sortable.
  14. A

    Importing values from a file

    You can use C++ iostreams to read from the file - since the default value delimiter is tabs, whitespace, and newlines, you should be able to simply read one value at a time using the >> operator.
  15. A

    Project Builder Compile error

    To avoid that warning and its assciated slow compile time, run this command in terminal sudo fixPrecomps This rebuilds the out-of-date precompiled header files, including Carbon.p. If you're doing C++ development, you might as well sudo fixPrecomps -gcc3all So that the Obj-C++...
  16. A

    More code editor...

    The NSTextStorage doesn't manage the selection; the NSTextView does. The methods in question are -setSelectedRange: and -selectedRange, the latter is adopted by NSTextView as part of the NSTextInput protocol.
  17. A

    code editor

    You can't get at the NSTextStorage from IB. You'll have to do it in code, preferably in your controller object's -awakeFromNib
  18. A

    Help a wee lad wit a Cocoa problem

    Here's one thing you could do: Set the class of the "File's Owner" in each of your nibs to your class. Make all necessary connections to File's Owner now that it will be the instance of your class. Then, when you load the nib using loadNibNamed:owner:, pass in the same one instance of that...
  19. A

    Where are the headers ?

    Compiler header files are kept in /usr/include. So, your socket.h would be /usr/include/sys/socket.h Also, sockaddr_in is defined in <netinet/in.h>
Back
Top