Hi, I've been trying to use IKImageView, but have some issues: 1. After using rotate, image knows about changes but is still the same size as loaded, imageSize shows new size after rotate but not image itself. How can i take this picture with new size? There is nothing in documentation about that. [...]]]>
[...] I assume you mean you want to run a program with arguments. If you're trying to run a command-line program, it would be better to use NSTask rather than NSWorkspace. Cheers, Chuck]]>
Hi First some background: We are in the process of porting a multi-platform application (ERP and CRM) to cocoa. (we have a carbon client today, but also many other platforms). Because of the multi platform aspect and large number windows (about 100k windows in total for all languages) we can not use interface builder for the windows. My problem: In many of our records (such as "invoice" or "general ledger transaction") we have what we call matrices (invoice rows are a good example). Right now we have implemented them with a NSTableView and it works fairly OK. In these matrices we have the possibility for special "typed rows", such as a "payment row" for cash invoices. (you buy 8 items, and pay $300 cash and $500 with one credit card, $500 with another, and then get $27.55 in change for example). These typed rows need a different positioning of the data than the normal columns (they have e.g. labels in the row to explain what type of row it is). I think I understand how to solve the display part by using tableView:dataCellForTableColumn:row: and supplying a full-width cell (custom subclass), and then painting the fields inside by drawing other cells. But how do I solve that some of these cells need to be editable by the user? Alternatively, is there any way to reposition the cells horizontally (and change their width) for a specific row? Regards Erik]]>
[...] Implementing the window delegate method 'windowWillReturnUndoManager:' to return the correct undo manager should do what you want.]]>
[...] You understood correctly. The restriction I described is for 32-bit apps.]]>
[...] Or rather, you'll want to do this in a more OO approach, i.e. abstract your custom print panel stuff away into a class. The base class is linked into your app, and the loadable bundles implement subclasses of these. Your app simply uses these classes, and they take [...]]]>
Is it possible to use NSWorkspace to open a file and pass in command line arguments? I can't see anything in the docs about this and I haven't found anything with google either. Thanks Jim]]>
[...] As far as I've seen so far, whenever a new layer is created, it is inserted in the front. The only way I've found to fix it is to set the zPosition of each view's layer manually. However, luckily that seems to work :-) Cheers,]]>
In my application, I would like to give my users the option to choose various interface styles. I've laid out my interface using a standard NSPanel as well as the HUD version. Both are suitable, but some users will prefer one over the other, of course. [...]]]>
[...] Generally, just use them. I think you're overstating the effects of having a method be deprecated. It is not a big "EJECT!" warning that suddenly lights up. It's more like a "service engine soon" light. You can keep driving until the parts start to fall off the car, it's just better if you're able to get it looked at sooner. Likewise, "deprecated" just means that use of the method is discouraged, particularly in new code. The reason that they are deprecated and not simply removed is so that old code continues to work. Generally deprecated code isn't removed for a very long time, if ever. If you look at APIs that have been deprecated in the past, they've failed to jump transitions that break binary compatibility (like 64-bit), but otherwise stick around. Sometimes, like in this particular case, the method is discouraged because its use now has some sort of negative impact on the application. In that case you should analyze how much work it will be to take the dual-method approach described in this thread and whether that work is worthwhile to overcome the negative impact. Mike]]>
[...] The earlier emails seem to mention that for 64bit apps this will not be a problem. Is that the case or did I misunderstand them?]]>
Thank you very much for your reply and help - very clear and much appreciated. Many thanks, Keith Le 5 juil. 08 à 15:56, Jean-Daniel Dupas a écrit : [...] I forget to mention one point. I guess your bundle (with your pronter view and specifi nib) will use some classes and functions from your application. If this is the case, you will have to do workaround some minor issues. When you will try to link your bundle, the linker will says that your bundle is undefined symbols. You can either specify to the linker where it should search for thoses symboles; in your application. To do this you use the "Bundle Loader" build setting. Or you may say to the linker to resolve undefined symbol at runtime (use Other Linker Flags build setting to pass "-undefined dynamic_lookup").]]>
[...] Yes the server has sent the bytes to the client. I did do a tcpdump to verify. Also, Firefox was able to render the first chunk whereas Safari as well as my application couldn't.]]>
Thanks for the answer. I have submitted a bug. On Sat, Jul 5, 2008 at 4:18 PM, Andreas Mayer <email@hidden> wrote: [...]]]>
Le 5 juil. 08 à 15:56, Jean-Daniel Dupas a écrit : Le 5 juil. 08 à 15:46, Keith Blount a écrit : [...] I forget to mention one point. I guess your bundle (with your pronter view and specifi nib) will use some classes and functions from your application. [...]]]>
Le 5 juil. 08 à 15:46, Keith Blount a écrit : [...] In your project, create a new "Cocoa Bundle" Target (that will contains all Leopar specifics classes). Then set the SDK to 10.5 and deployment version to 10.5 for this target. Include this new bundle in your application resources, and load it using NSBundle resource at runtime. Attachment: smime.p7s Description: S/MIME cryptographic signature]]>
Never mind. I figured out I can detect action dismissal with a simple boolean (actionDismissed = YES when receiving a NSPopUpButtonWillPopUpNotification, actionDismissed = NO when receiving a NSMenuWillSendActionNotification). On Sat, Jul 5, 2008 at 2:46 PM, Fabian <email@hidden> wrote: [...] [...]]]>
Many thanks for your reply, much appreciated. Where can I find information on creating bundles and linking them only against a certain OS? I'm obviously using the wrong search terms in both the docs and in Cocoa-dev... Under the NSBundle documentation it explains how to get a class out of an existing bundle using -principleClass, but I can't see how to turn a class into a bundle, or how to link the bundle specifically against Leopard, for instance... Is there an example of how to do this somewhere? Many thanks again and all the best, Keith On Jul 5, 2008, at 5:08 AM, Keith Blount wrote: [...] To handle a case like this, you are going to have to create a bundle that you link against the 10.5 SDK and only load there. This bundle will contain your NSViewController subclass and allow you to conditionally call -setAccessoryView: on 10.4 and - addAccessoryViewController: on 10.5. This is a general pattern that you can use when you want to provide alternate functionality where it is a requirement to subclass and that subclass only exists on a newer version of the OS. As for -setAccessoryView: (and other deprecated methods) there really isn't a case of formal vs informal deprecation - deprecated is deprecated. In this particular case, using -setAccessoryView: for example will disable the inline print preview, so you'll want to avoid calling it on 10.5.]]>
[...] To handle a case like this, you are going to have to create a bundle that you link against the 10.5 SDK and only load there. This bundle will contain your NSViewController subclass and allow you to conditionally call -setAccessoryView: on 10.4 and - addAccessoryViewController: on 10.5. [...]]]>
Hi,
Thanks for your reply. My project is set up just as you suggest and in fact I do use checks to see whether selectors are available and use the newer methods or older methods where appropriate where I can. But in the case I was talking about, there is a whole class that is unavailable - NSViewController. So, to use the new method (-addAccessoryController:) I would first need to create a subclass of NSViewController and include this subclass in the project. But given that the superclass (NSViewController) would not be available on Tiger, this would cause it to stall on Tiger. So I would need some way not only of checking for a particular method, but also of ignoring a whole class/subclass on the Tiger version... Moreover, the .nib file holding the accessory view would need to be connected up differently depending on whether it was using an NSViewController or not, meaning that there would probably need to be two different .nibs - identical in looks but
different in connections, one of which was ignored on Tiger, the other ignored on Leopard...
Hope that makes sense.
All the best,
Keith
Le 5 juil. 08 à 14:08, Keith Blount a écrit :
[...]
What make you think so ? You cna perfectly use 10.5 only symbol and
target 10.4 as long as you check that this symbol exist before your
use it.
if (MyLeopardOnlyFunction)
MyLeopardOnlyFunction(foo, bar, other);
You just have to be sure that your properly configure your project,
that is set SDK to th emax target version( 10.5) and set deployment
target to the min version (10.4)
So you just have to do something like this:
if ([myPanel
respondsToSelector:@selector(addAccessoryViewController:)] ) {
// go the nsviewcontroller way
} else {
// use the old way
}
]]>Hi, I need a notification when the user dismisses a popup menu _without having actually clicked on a menu item_. A clumsy way of doing this would be to check if the mouse is hovering over the menu in NSPopUpButtonCell's "popUpDismissed" method. This way I can detect if [...]]]>
Le 5 juil. 08 à 14:08, Keith Blount a écrit : [...] What make you think so ? You cna perfectly use 10.5 only symbol and target 10.4 as long as you check that this symbol exist before your use it. if (MyLeopardOnlyFunction) MyLeopardOnlyFunction(foo, bar, other); [...]]]>
Am 05.07.2008 um 08:37 Uhr schrieb Vitaly Ovchinnikov: [...] I couldn't find a way to add "Sent Actions" to a custom control either. Just hook it up per code in awakeFromNib - and file a bug on IB if it bothers you. Andreas]]>
Hi, Something that has bothered me for ages in Cocoa, but which I've always put to one side, is how to handle certain deprecated methods when supporting more than one OS. In some instances it's as simple as checking at runtime which OS is being used and using the appropriate method accordingly, but I'm wondering here about the trickier instances. For instance: I am currently overhauling printing in my application. I have a page layout accessory view and I now also want to add a print panel accessory view. My app runs on both Tiger and Leopard. -setAccessoryView: works on both Tiger and Leopard, for adding an accessory view to both NSPageLayout and NSPrintPanel. However, in both cases, -setAccessoryView: was (rather frustratingly in this case, I feel, as it worked fine) informally deprecated on Leopard. Instead, we are advised to use -addAccessoryViewController:, which uses an NSViewController. But the NSViewController class doesn't even exist on Tiger, so subclassing it and having it in the project will cause the app not to run on Tiger at all. I don't want a different build for both Tiger and Leopard, of course, So, what is the proper way of handling this? The path of least resistance is to use -setAccessoryView: and hope it doesn't get formally deprecated on Snow Leopard, and continues to work for a while despite its deprecated status. But that obviously isn't the *best* (or correct) way of doing things. Any alternative is going to be more complicated and involve having separate elements of code for Tiger and Leopard, which isn't ideal, but I would love to know the established way of handling this. Sorry if this question is a little dumb to those of you experienced in maintaining apps over several OS releases; I would be very grateful for your advice, though. Many thanks in advance and all the best, Keith]]>
Hi everyone, I upgraded to iPhone SDK beta 8 and all of a sudden my project doesn't work. In fact, the examples don't work either. They all generate the same error message: "Something.xib" could not be handled because ibtool cannot open files of this type. Excuse me? [...]]]>
Hello, I have a rather complicated undo setting My document Object has a Array of independent graphical items (containing some properties). Each item should have its own undo/redo based of selection in the interface. So I select Item_1, modify it, select Item_2 and modify it, too. [...]]]>
Does anybody use custom controls? I just created new project with new
NIB, added construction like
@interface MyControl : NSControl {} @end
Opened NIB, placed Custom View object to the window, changed its type
to "MyControl", right clicked there and I didn't see "Sent Action"
group. [...]]]>[...] Technical Q&A QA1355 Why aren't my tracking rects working? Q: I'm trying to implement tracking rectangles so that I can recieve - mouseEntered: and -mouseExited: messages and provide visual feedback to the user. I've sent my view an - addTrackingRect:owner:userData:assumeInside:message, but it seems to have no effect. A: This symptom usually results from trying to set tracking rectangles before your view has been added to a window. Although NSView implements the - addTrackingRect:owner:userData:assumeInside: method, the list of tracking rectangles is kept by the window, not the view. When your - initWithFrame: method is executed, your view is not yet associated with any window, so the view can't actually set any tracking rects. A better place to send your -addTrackingRect:.. messages is in a - viewDidMoveToWindow: or -awakefromNib method.]]>
[...] Heh, internal links for the lose -- anyone trying to follow it, try this one instead: <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindow_Class/Reference/Reference.html#//apple_ref/occ/instm/NSWindow/setPreferredBackingLocation: [...] [...]]]>
Thanks for the info David :) El 04-07-2008, a las 21:28, David Duncan escribió: On Jul 4, 2008, at 10:42 AM, Mario Gajardo Tassara wrote: [...] Mario Gajardo Tassara email@hidden]]>
[...] There are two methods you can use in a Cocoa app. For all windows app wide (probably your situation) add the "QuartzGLEnable" key to your Info.plist (with boolean value true). For specific windows, call setPreferredBackingLocation: with the value NSWindowBackingLocationVideoMemory. [...]]]>
no. You'll need to set some sort of flag that prevents any other actions from happening for the period of time the animation takes. you an do this using a timer to 'shut off' the flag, or you can use explicit animations rather than implicit ones and then implement the [...]]]>
[...] Are you sure that the data is even being sent when you want it to be? Until you've verified that it's making it onto the network by looking at the traffic with a network sniffer, I would hesitate to start assigning blame and debugging anything. [...]]]>
[...] This is a standard technique to use when subclassing controls or other custom views. The reason it works is because menu and control tracking is usually done by running a separate custom event loop, and control is only returned to the caller once tracking is complete. [...]]]>
Greg wrote: On Jul 4, 2008, at 2:17 PM, Markus Spoettl wrote: [...] Then either you're not successfully setting the level or you're not setting it to a high enough level. What level *are* you setting it to?]]>
QuartzGL is not currently available by default in OS X. You can turn it on with the Quartz Debug application. In addition, this message would probably be suited better for the Quartz discussion list. On Jul 4, 2008, at 10:42 AM, Mario Gajardo Tassara wrote: [...] [...]]]>
Oh! Actually, it was because the window was being run as modal. Make sure the window is not being run in a modal loop and it should work. - Greg On Jul 4, 2008, at 5:19 PM, Greg wrote: Sorry, suddenly it works, I think that during my attempts at [...]]]>
Sorry, suddenly it works, I think that during my attempts at "fixing" it I had some code running that would cause the setLevel code to be ineffective. It works now, simply setting the level does the trick. Just a note to anyone else experiencing problems with this, make sure [...]]]>
I've been working in a little app which is laced with CA effects bit essentially is a simple list manager. There's a few NSTextField controls and other input controls in a view which flips, fades etc and it seems that there's a fundamental issue [...]]]>
[...] This situation should work. If it does not, that's something to report to Apple via the bug reporter http://bugreport.apple.com/ and, if possible attach a test case that demonstrates the issue. Do not assume that it's simply the collector "follow[ing] its own rules. [...]]]>
Am 04.07.2008 um 18:16 Uhr schrieb Gary L. Wade:
[...]
Well, I find *this* one preferable:
#if WE_WANT_TO_ADD_THIS_FEATURE_IN_FINAL_BUILDS
if (thisTestIsTrue && newFunctionalityIsAvailable) {
#else
if (thisTestIsTrue) {
#endif
...
}
else
{
... [...]]]>[...] You cannot throw C++ exceptions across Objective-C functions. If you want to catch this exception, you will have to catch it in drawRect, and decide there what to do with it.]]>
[...] Please do not spread misinformation about Objective-C garbage collection. What you're essentially asserting is that Objective-C garbage collection will always increase the high-water mark of an application, and that is not the case. Memory in a GC app is released very soon after the life of an object is over -- sometimes, even sooner than it would be under manual memory management. That's because Objective-C garbage collection runs on a separate thread. Under non-GC, an object's memory may not be reclaimed until the current autorelease pool is drained. However, under GC, an object's memory can be reclaimed as soon as the collector can tell there are no more references to it -- no matter when that is. -- Chris]]>
[...] Argghh. Oh well. Something to look forward to in the future. Thanks to all for the info!]]>
[...] 64-bit is the sticking point. If you build for 64-bit, they're unified, but Apple can't change the 32-bit runtime on the Mac for compatibility reasons. So the switch would be setting the architecture to 64-bit and removing the 32-bit architecture. [...]]]>
I'm developing this on 10.5, Xcode 3.0. Is that considered the newer version, or is there an Xcode setting that I need to explicitly adjust for this? On Fri, Jul 4, 2008 at 3:45 PM, Bill Bumgarner <email@hidden> wrote: [...]]]>
Another way to do this is to implement the NSMenu delegate methods: - menuWillOpen: - menuDidClose: You would then set the highlighted variable there. I think it'll make the code easier to read. You need to set the menu's delegate for this to work (obviously). [...]]]>
In the 32 bit [legacy] Mac OS X runtime, C++ and Objective-C exceptions Do Not Mix. Oil & water. C++ exceptions are ignored by @try/@catch and vice-versa. In the modern runtime (64 bit Mac OS X & elsewhere), the exception model has been unified. [...]]]>
I have found stuff on the internet about issues with throwing C++ exceptions, and I've run into something which I think is what these articles are talking about but I'm not 100% sure so I thought I'd ask. I have some C+ code that is being called as a result of the AppKit [...]]]>
[...] Hi, sorry, I meant to say level instead of "layer" in my original email. I'm already doing this but it doesn't work. The application that's displaying the window is an LSUIElement hidden application, if that helps. When it displays the window it *does* go above all [...]]]>