Re: Network Reachability
On Fri, Jan 29, 2010 at 2:37 PM, Jens Alfke wrote: > > On Jan 29, 2010, at 11:12 AM, Laurent Daudelin wrote: > >> I was able to determined that when the connection is down, I found out that >> kSCNetworkFlagsConnectionRequired was true, so it seems to work. It's just >> difficult to determine what exactly the flags mean. > > This can be confusing. Connection-required is for things like dial-up modems: > it means the host isn't reachable now, but may be if an action is taken to > make a connection (like dialing a modem.) This isn't really useful any more, > but it used to be that the app could look up which interface supported the > connection, then either autodial or prompt you whether you wanted to connect. > > These days you can pretty much treat that flag as meaning "no connection". Dialup is more common than you might think. Millions of people still use it, either because it's cheap or it's all they can get, and a lot of those people have Macs. "Connection required" is *far* more common than you might think. It applies not only to dialup, but to things like PPPoE, which is extremely common for DSL connections. If the Mac is connected directly to the DSL modem, it will use PPPoE. If the PPPoE connection is set up not to be connected all the time, and if the user isn't actively using the internet at the time, the PPPoE connection could very easily be disconnected, and Reachability will return kSCNetworkFlagsConnectionRequired in that case. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Loading of Mach-O executable files.
Le 29 janv. 2010 à 16:58, Richard Penwell a écrit : > Dear list, > > I've been toying around with some problems in the world of dynamic code > loading... (a vast and mythical place). I understand that there is a > fundamental difference between Mach-O executables and Mach-O dynamic > libraries (beyond the obvious Mach-O filetype header). I assume it has to do > with a concept I've read about known as Position Independent Code, in that > Dynamic Libraries are PIC and executables (assuming that they are the first > object to load and therefore could not have to content for a VM address > range) are not. The question goes something like this: > > Given I have a Mach-O executable file that contains a symbol that I wish to > be able to call is there any way to use dlopen or NSBundle load to bring > those symbols into another executable? > > I have attempted the following two methods: > > NSBundle *applicationBundle = [[NSBundle alloc] > initWithFile:@"path/to/mach-o/executable"]; > [applicationBundle load] > > The above results in: > 2010-01-29 10:07:41.812 LoadPagesDynamically[93324:a0f] Attempt to load > executable of a type that cannot be dynamically loaded for CFBundle > 0x1001161b0 (executable, not loaded) > > Also: > > void* pages_application = dlopen("path/to/mach-o/executable", RTLD_NOW); > > The above results in pages_application == NULL with no errors being reported. > > If it is not possible (I suspect not), is it possible to convert executable > object code to a PIC representation to be dynamically loaded? > > I imagine that there may be something that I don't know given Apple's history > of binary magic (fat binaries, rosetta etc). > > It seems that this is a dark corner of the DYLD system that isn't well > documented as to the technical aspects of why this isn't done. > > I've tried to be as detailed as possible, but if you would like more > information as to what I've tried, please let me know. > > Thanks, > Richard If you have a dylib question, ask on the darwin-...@lists.apple.com . This is where dylib specialists are. -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: dock tile overlay image
Le 29 janv. 2010 à 17:02, Felipe Heidrich a écrit : > Using Carbon I can place overlay images on the application dock tile by > calling OverlayApplicationDockTileImage(). > > Is it possible to do the same using Cocoa ? > I read NSDockTile and NSApplication Class Reference and I'm afraid the > answer is no. > > I could use the old carbon API (OverlayApplicationDockTileImage) but > fortunately it doesn't work on 64 bits. > > Any ideas ? You can easily compose the image youself. NSImage *icon = [NSApplication applicationIconImage]; [icon lockFocus]; CGContextRef ctxt = [[NSGraphicsContext currentContext] graphicPort]; CGContextDrawImage(ctxt, myDestRect, myOverlay); [icon unlockFocus]; [NSApplication setApplicationIconImage:icon]; Note that you will have to backup the original icon image if you want to do this more than one time. You can also use NSDockTile and use a custom view to draw the application icon and your overlay. -- Jean-Daniel ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Loading of Mach-O executable files.
On Jan 29, 2010, at 7:58 AM, Richard Penwell wrote: > I've been toying around with some problems in the world of dynamic code > loading... (a vast and mythical place). I understand that there is a > fundamental difference between Mach-O executables and Mach-O dynamic > libraries (beyond the obvious Mach-O filetype header). I assume it has to do > with a concept I've read about known as Position Independent Code, in that > Dynamic Libraries are PIC and executables (assuming that they are the first > object to load and therefore could not have to content for a VM address > range) are not. The question goes something like this: > > Given I have a Mach-O executable file that contains a symbol that I wish to > be able to call is there any way to use dlopen or NSBundle load to bring > those symbols into another executable? > > I have attempted the following two methods: > > NSBundle *applicationBundle = [[NSBundle alloc] > initWithFile:@"path/to/mach-o/executable"]; > [applicationBundle load] > > The above results in: > 2010-01-29 10:07:41.812 LoadPagesDynamically[93324:a0f] Attempt to load > executable of a type that cannot be dynamically loaded for CFBundle > 0x1001161b0 (executable, not loaded) > > Also: > > void* pages_application = dlopen("path/to/mach-o/executable", RTLD_NOW); > > The above results in pages_application == NULL with no errors being reported. > > If it is not possible (I suspect not), is it possible to convert executable > object code to a PIC representation to be dynamically loaded? > > I imagine that there may be something that I don't know given Apple's history > of binary magic (fat binaries, rosetta etc). > > It seems that this is a dark corner of the DYLD system that isn't well > documented as to the technical aspects of why this isn't done. > > I've tried to be as detailed as possible, but if you would like more > information as to what I've tried, please let me know. As mentioned earlier, you'll get better answers from darwin-...@lists.apple.com. You cannot convert a non-PIC binary to PIC. The compiler and linker will have made optimizations to the non-PIC binary that you can't undo without rebuilding it from scratch. A typical main executable is also missing the symbol tables that would be needed for other code to link to its symbols. In theory, you could build a PIC-capable symbol-rich main executable. Then there's no technical restriction against loading it into another process, other than that dyld isn't designed to do that and most executables wouldn't be usable that way anyway. -- Greg Parker gpar...@apple.com Runtime Wrangler ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
On Jan 29, 2010, at 22:52, Jerry Krinock wrote: > In "Cocoa Bindings Programming Topics" ▸ "What Are Cocoa Bindings" ▸ > "Supporting Technologies", I read: > > "A binding is established with a bind:toObject:withKeyPath:options: >message which tells the receiver to keep its specified attribute >synchronized ... with the value of the property... The receiver >must watch for ... changes in the object to which it is bound and >react to those changes. The receiver must also inform the object >of changes to the bound attribute. ... There are therefore two >aspects to keeping the model and views synchronized: responding >to user interaction with views, and responding to changes in >model values." > > This clearly states, twice, that ind:toObject:withKeyPath:options: creates > something which is bidirectional. > > Then, in "Cocoa Bindings Programming Topics" ▸ "How Do Bindings Work" ▸ > "BIndings in More Detail", I read: > > "In its bind:toObject:withKeyPath:options: method an object must > as a minimum do the following: > > • Determine which binding is being set > • Record what object it is being bound to using what keypath > and with what options > • Register as an observer of the keypath of the object to which > it is bound so that it receives notification of changes." > > This tells me that, "as a minimum", a binding is only unidirectional. > > How do you know when a binding is going to be unidirectional or > bidirectional, and how can you control this? OK, so here's how I understand this (which may or may not be correct) ... 1. The word "binding" is ambiguous. It refers on the one hand to the behavior of a class that allows it to synchronize some attribute (such as a property, but it could be something internal like an instance variable) to a property of target objects. It also refers on the other hand to the actual link from a specific instance of the class to a target object. This is the same sort of distinction as that between "class" and "object" (a type/token distinction, if you know that terminology), but there just aren't two words for it. 2. A binding link is *always* bidirectional (unless its mis- or only partially implemented). 3. Binding behavior in each class is responsible for implementing the bidirectionality. 4. Binding behavior implements the NSKeyValueBindingCreation protocol, which includes the 'bind:...' method. Invocation of that method is the mechanism by which a binding link is established. The method is *not necessarily*, by itself, the binding behavior. That's the essential point: the binding behavior is *more than* this one method. 5. The NSObject implementation of the 'bind:...' method does the minimum listed above, plus it causes the change notification to be handled, in the case where the binding name is actually a property name. In that case the attribute (a property) is updated to match the target object property. (I don't know what happens if you specify a non-property name. Maybe an exception, or maybe nothing.) 6. Therefore, NSObject's 'bind:...' method *in isolation* can serve as a one-way property synchronization link, which you may choose to call a "unidirectional binding", though I think it's a terrible mistake to think of it as any kind of binding. 7. NSObject provides no implementation of the rest of a binding's behavior, which is why there's a fair amount of code still to write for a custom binding behavior, even if NSObject's standard 'bind:...' implementation forms part of the custom behavior. 8. Therefore all of the documentation quoted above is correct. A binding [link] is established with a 'bind:...' message which [when sent] tells the receiver to keep its specified attribute synchronized [via its implementation of binding behavior] ... [The binding behavior of t]he receiver must watch for ... 9. The reason that the opposite direction of the binding link isn't "in" the 'bind:...' method is that this direction is triggered by actual attribute changes, not by KVO notifications (or, at least, not necessarily via the KVO mechanism -- remember that the attribute doesn't have to be an actual property). IIRC most of the additional crap you have to write to implement a custom binding [behavior] is related to detecting and processing these attribute changes. 10. The reason one direction has a standard implementation in NSObject and the other direction doesn't is that the implementation of the first is typically abstractable, while the implementation of the second is class- and even binding-name-specific. In short: binding [link] != binding [behavior] != 'bind:...' method For completeness, I would add: 11. A "Cocoa binding" is a custom binding implemented in the frameworks for most (NS) view and user interface objects, which extends basic binding behavior with additional functionality, such as special handling of NSController o
Re: Displaying animated content in iPhone app
Op 28 jan 2010, om 18:35 heeft David Duncan het volgende geschreven: > On Jan 28, 2010, at 6:22 AM, patrick machielse wrote: > >> - I've seen mentioned that movie playback inside a view is not currently >> supported in the frameworks. I've also not found support for movie file >> formats (you can only pass a url into the iPhone frameworks, that's it). > > Keep in mind that a URL can point to a local file too. Yes. What I meant by that remark was that there seems to be no way to access individual movie frames, which would be convenient if I have to implement a 'movie view' myself. >> Ultimately, the only approach left at this moment seems to be to create a >> movie playback view myself using Quartz? I really would like to forgo this >> if there is a way (or if there is existing code available). >> >> So, what are the current options for displaying movie like content in your >> app and have a decent control over playback and display? > > As Glenn mentioned there is the UIImageView's animationImages property. You > can gain more control by dropping down to the Core Animation level as well. > And there is always OpenGL ES. I've given animationImages a try, and although performance is good I run into memory warnings when the array contains about 30 full screen images (1 Sec. worth). I've tried to implement my own NSView subclass -- managing memory for UIImages or CGImages more strictly -- but I've not been able to attain acceptable frame rates (yet). If drawing and memory usage can be optimized by using OpenGL directly I would be grateful for tips or examples. My app uses frame based animation, so I think Core Animation probably doesn't apply. patrick___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
> 1. The word "binding" is ambiguous. It refers on the one hand to the behavior > of a class that allows it to synchronize some attribute (such as a property, > but it could be something internal like an instance variable) to a property > of target objects. It also refers on the other hand to the actual link from a > specific instance of the class to a target object. This is the same sort of > distinction as that between "class" and "object" (a type/token distinction, > if you know that terminology), but there just aren't two words for it. I think of it less in terms of synchronisation, and more in terms of dynamically rewriting the location of load/store operations at runtime. > 2. A binding link is *always* bidirectional (unless its mis- or only > partially implemented). This isn't true, the directionality of a specific binding is documented per implementing class. > 3. Binding behavior in each class is responsible for implementing the > bidirectionality. Correct. > 4. Binding behavior implements the NSKeyValueBindingCreation protocol, which > includes the 'bind:...' method. Invocation of that method is the mechanism by > which a binding link is established. The method is *not necessarily*, by > itself, the binding behavior. That's the essential point: the binding > behavior is *more than* this one method. Correct, an object being sent -bind:… can optionally register as an observer for the same key path. >> "In its bind:toObject:withKeyPath:options: method an object must >>as a minimum do the following: >> >> • Register as an observer of the keypath of the object to which >> it is bound so that it receives notification of changes." I half agree with this statement (even though it's from the documentation). As a controller telling another object to -bind:…, you don't care if it observes. However, you must maintain the observability contract; ensuring that if the receiver does decide to observe the key path, that the key path is KVO compliant. An object deciding to observe the key path for a binding is an implementation detail. If an object doesn't maintain and present additional state, based on the current state of the binding, it doesn't need to observe it. > (I don't know what happens if you specify a non-property name. Maybe an > exception, or maybe nothing.) -setValue:forKeyPath: allowing you to handle it in -setValue:forUndefinedKey: Note that if you're using the NSObject implementation of -bind:…, internally there are invocations of -valueForKey: on the receiver of -bind:… too. So, your bound object needs to be fully KVC compliant for the key you're binding, this might mean implementing -valueForUndefinedKey: too. > 7. NSObject provides no implementation of the rest of a binding's behavior, > which is why there's a fair amount of code still to write for a custom > binding behavior, even if NSObject's standard 'bind:...' implementation forms > part of the custom behaviour. Not strictly true, since the default implementation still stores the binding info allowing you to retrieve it using -infoForBinding:. This allows you to override -bind:… and internally rewrite it to use the NSObject implementation but bind to a private and internal property. To set the value back you access the binding info stored for you by the default implementation. You only really need to write a complete implementation of -bind:… if you need to store additional information, or customise the observation. > 10. The reason one direction has a standard implementation in NSObject and > the other direction doesn't is that the implementation of the first is > typically abstractable, while the implementation of the second is class- and > even binding-name-specific. I've written an abstract implementation of the reverse direction. In my extensions AFKeyValueBinding there are two useful methods, -valueForBinding: and -setValue:forBinding:, which introspect the -infoForBinding: dictionary, and send -valueForKeyPath: and -setValue:forKeyPath: respectively. They also handle pushing the value through the value transformer identified by the NSValueTransformerBindingOption/NSValueTransformerNameBindingOption options. > 11. A "Cocoa binding" is a custom binding implemented in the frameworks for > most (NS) view and user interface objects, which extends basic binding > behavior with additional functionality, such as special handling of > NSController objects, and their pre-defined special keys, as binding link > targets. This implementation is private and not available to the developers > writing their own custom bindings (except, of course, to the extent it can be > leveraged by subclassing). Do you mean the NSEditor and NSEditorRegistration protocols? These are available for you to use in classes exposing their own bindings. By the special keys do you mean the binding name strings, or the special values returned by them? The value markers are exported a
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
On Jan 30, 2010, at 4:24 AM, Quincey Morris wrote: Does that throw any light on the matter? Yes! --Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Highlighting search results in table
Hi All, I have a NSTableView bound to an array controller. I am using an NSSearchField to create a predicate for my search, and setting it on the array controller. All works perfect. I was wondering if there is any simple way to actually highlight the portion of the text matching in the relevant rows in the table? I already check each cell to see if I ned to change its background colour to highlight an out of bounds style value on a numeric field, should I take a similar approach for my search fields? If so, how should I best implement it? regards, --- Grant Christensen ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Returning a nil float?
thanks. NAN seems to be the simplest solution. On Fri, Jan 29, 2010 at 10:00 PM, Greg Guerin wrote: > Chunk 1978 wrote: > >> so above i'd like to write "if (!sound) return nil;". my reasoning is >> because some attributes to a sound object (like pan) are created only >> when the sound is initialized. if there is no sound object than there >> should also be no pan value to return. unfortunately, the float >> default 0.0f is also the default value for pan (range from -1.0 to >> 1.0). > > > You could return NaN to signify "no pan value". > > You should read up on the characteristics of NaNs, though. They don't > compare equal to anything, even another NaN or itself. Using them in > arithmetic also yields "interesting" results. > > man nanf > man isnan > > http://en.wikipedia.org/wiki/NaN > > -- GG > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/chunk1978%40gmail.com > > This email sent to chunk1...@gmail.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
Keith, thanks for your comments too. On 2010 Jan 30, at 03:24, Quincey Morris wrote: > Does that throw any light on the matter? Obviously, yes. Now let me try and answer my original questions... > How do you know when a binding is going to be unidirectional or bidirectional You must study the implementation of this method in the object receiving the bind message or, if that's private, the Cocoa Bindings Reference (i.e. "Binding is Read-only"). > how can you control this? By subclassing and writing your own implementation of bind. > Why are bindings A, B, C and D bidirectional but E is only unidirectional? Regarding A, B, C and D: Apparently, NSButton's implementation of bind sets up observers in both directions when binding to the "value" binding. Regarding E: Foo does not implement bind:::, so NSObject's implementation is used, and this implementation, apparently, only sets up one observer in one direction. So here's another addition to my growing list of Why Dummies Like Me Find Bindings So Confusing To the documentation, - (void)bind:toObject:withKeyPath:options: Establishes a binding between a given property of the receiver and the property of a given object specified by a given key path. I would add this: Details: We might say that the default implementation establishes a binding which is unidirectional -- observes and passes value changes only from the bound-to object back to the receiver. But if we said that, we'd have to document the implementations in the many Cocoa subclasses of NSObject which override this method to establish bidirectional bindings. But since we didn't say that, we don't need to document all those overrides, and you must look instead in the Cocoa Bindings Reference to find out whether "Binding is Read-Only". Tip: When using this (NSObject) implementation, you *may* find that it establishes a unidirectional binding ;) ;) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Returning a nil float?
Le 30 janv. 2010 à 16:11, Chunk 1978 a écrit : > thanks. NAN seems to be the simplest solution. At the same time, if your float is supposed to lie in the range [x, y], returning any float outside this range (and not necessarily a NAN) can mean whatever you want. Vincent___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
>> Why are bindings A, B, C and D bidirectional but E is only unidirectional? > > Regarding A, B, C and D: Apparently, NSButton's implementation of bind > sets up observers in both directions when binding to the "value" binding. This isn't what happens, run the following code: > static NSString *const PropertyKey = @"somethingEnabled"; > > NSMutableDictionary *model = [NSMutableDictionary > dictionaryWithObjectsAndKeys: > (id)kCFBooleanFalse, > PropertyKey, > nil]; > > NSButton *button = [[NSButton alloc] initWithFrame:CGRectMake(0., 0., 100., > 27.)]; > [button setButtonType:NSSwitchButton]; > [button bind:NSValueBinding toObject:model withKeyPath:PropertyKey > options:nil]; with a breakpoint set on -[NSObject addObserver:forKeyPath:options:context:] and you'll see that -addObserver:forKeyPath:options:context: is only called once from inside -bind:… What NSButton does when it needs to change the value of it's bound to counterpart, is introspect the binding either through -infoForBinding: (or other means depending on where it stored the captured binding information, we'll assume the -infoForBinding: case for simplicity). It extracts the bound-to object (stored under NSObservedObjectKey), and the keypath (stored under NSObservedKeyPathKey) and invokes [observedObject setValue:newValue forKeyPath:observedKeyPath]. (NSValueTransformer code left out for brevity). Keith ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Tabbed windows
On Jan 29, 2010, at 3:40 PM, John Nairn wrote: > Is it possible for non-Apple program to integrate into the tool bar of the > window? Google Chrome has tabs that are actually integrated into the title bar. It requires some fairly nasty hacking (splicing methods into private classes) so I wouldn't recommend it; but if you want to see how it's done, look in the Chromium.org open-source repository. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Working with external drives with Cocoa.
On Jan 29, 2010, at 9:16 AM, Wilersh wrote: > Is there is a way to work with external drives inside cocoa as you might at > the command line with diskutil. As with many things, there's no Objective-C API for it, but you can use all the lower level C APIs and system calls. I'm not sure what the APIs for this would be, but the source code to diskutil is probably in the Darwin open-source repository so you can look at it yourself to see how it works. —Jens___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Tabbed windows
Take a look at http://www.positivespinmedia.com/dev/PSMTabBarControl.html Maybe this would satisfy your needs. Boyd On Jan 29, 2010, at 3:40 PM, John Nairn wrote: > I tried to find a way to do tabbed windows like Safari. Since they appear > integrated into the window title bar, I thought they might be part of the > NSWindow class, but I don't see anything there. Does one have to create their > own class for tabbed windows or is something built in to Cocoa? Is it > possible for non-Apple program to integrate into the tool bar of the window? > > --- > John Nairn > GEDitCOM - Genealogy Software for the Macintosh > http://www.geditcom.com > > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/bcollier%40sunstroke.sdsu.edu > > This email sent to bcoll...@sunstroke.sdsu.edu > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Tabbed windows
One way to do it (the way Chrome does it, if I'm not mistaken) is to add the toolbar view as a subview of NSThemeFrame. NSThemeFrame is a private subclass of NSView that can be accessed by using [[yourWindow contentView] superview]. Note, however, that this is entirely undocumented so use it at your own risk. You may need to do some tweaking to make the colors match between the window frame and the toolbar. Another less hacky (and supported) way is to use a child window. Create a transparent child window using NSBorderlessWindowMask and set your toolbar view as the content view of that window. You can then position the window over the titlebar of your main window, then add the toolbar window as a child window of the main window. In my experience, however, one of the issues with this approach is that the child window doesn't seem to resize along with the main window, so you'd have to listen for the NSWindowDidResizeNotification from the main window and resize the child window accordingly. hope this helps. Independent Cocoa Developer, Macatomy Software http://macatomy.com On 2010-01-30, at 10:32 AM, Jens Alfke wrote: > > On Jan 29, 2010, at 3:40 PM, John Nairn wrote: > >> Is it possible for non-Apple program to integrate into the tool bar of the >> window? > > Google Chrome has tabs that are actually integrated into the title bar. It > requires some fairly nasty hacking (splicing methods into private classes) so > I wouldn't recommend it; but if you want to see how it's done, look in the > Chromium.org open-source repository. > > —Jens > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/pcwiz.support%40gmail.com > > This email sent to pcwiz.supp...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: bind:toObject:withKeyPath:options: Unidirectional or Bidirectional?
On 2010 Jan 30, at 09:12, Keith Duncan wrote: >>> Why are bindings A, B, C and D bidirectional but E is only unidirectional? >> >> Regarding A, B, C and D: Apparently, NSButton's implementation of bind >> sets up observers in both directions when binding to the "value" binding. > > This isn't what happens, run the following code: My Time Manager says I should take your word for it on that :> > What NSButton does when it needs to change the value of it's bound to > counterpart, is introspect the binding either through -infoForBinding: (or > other means depending on where it stored the captured binding information, > we'll assume the -infoForBinding: case for simplicity). > > It extracts the bound-to object (stored under NSObservedObjectKey), and the > keypath (stored under NSObservedKeyPathKey) and invokes [observedObject > setValue:newValue forKeyPath:observedKeyPath]. Ah, indeed, it would be rather inefficient to tell someone else to observe your changes, call you back and get a value. Instead, just activate a branch in your own setter to push your changes out when one occurs. That makes much more sense, and also gives another reason why this is not generally referred to as a "bidirectional" or "two-way" binding. That implies symmetry, when in fact the mechanism in the two directions is quite different. Good work, Keith. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Google Irvine open house on the Jan 27th.
I wanted to extend my thanks to the people who attended our open house last week. The turnout among OCJug and Cocoaheads members was quite impressive, and higher than usual for such an event. As mentioned at the time, if you want to submit a resume, ping me at f...@google.com. I am also willing to answer follow-up questions (or to refer you to people who can), and to talk to people who were unable to attend the event. Thanks again, Scott ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Detect Tap on Word in UILabel?
Is it possible to detect which word was tapped in a UILabel in Cocoa Touch? It seems like it should be a pretty easy thing to do, but I'm stuck. Anybody ever try to do this? I know you can measure a string and get the bounding box that contains it; likewise, looking at the UITextInput protocol it has exactly the right methods (closestPositionToPoint & firstRectForRange), but these are limited 3.2 and don't seem to apply to UILabel. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTextView Drag and Drop
Hello, What is the best way to get access to the file that is dropped on an NSTextView. I don't want to embed the file in the view, but I'd like to copy the file somewhere else and add arbitrary text in its place. I'm thinking I should be looking at NSTextAttachment, but I'm not sure if I'm barking up the wrong tree here. Any pointers in the right direction are appreciated. Thanks, Jon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detect Tap on Word in UILabel?
no I don't think there is a way to do it directly. your best solution if you want to do this is subclass UILabel, draw the actual label yourself and then use the knowledge of how you drew it to figure out the closest character to the touch, if you just make a simple subclass like that, you can probably get interface builder to instantiate your own version quite easily. .. and Scott, the moderator, made it abundantly clear less than a week ago that discussion of unreleased software is *not allowed* on this list, so please just don't do it. On 31-Jan-2010, at 7:54 AM, Samuel Ford wrote: > Is it possible to detect which word was tapped in a UILabel in Cocoa Touch? > It seems like it should be a pretty easy thing to do, but I'm stuck. > > Anybody ever try to do this? > > I know you can measure a string and get the bounding box that contains it; > likewise, .. > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org > > This email sent to r...@rols.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Node hierarchy with subclasses
On Jan 29, 2010, at 9:38 AM, Jerry Krinock wrote: >> The problem is that when a subclass A is selected, the UI elements bound to >> subclass B no longer have valid bindings so generate an error. How can I >> solve this? > > In your tab view's delegate, implement tabView:willSelectTabViewItem:, and in > it, invoke -unbind: as needed on the currently-selected object. You can also uncheck the "Raises For Not Applicable Keys" in the bindings inspector pain in Interface Builder for your text fields. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com