Re: NSMatrix mouse puzzle
Thanks for your reply. The index variable is actually i: I forgot to change it when pasting the code into the email. So it does terminate after 10 seconds. The reason I want a delay is that the user is supposed to have 10 seconds only to look at the data displayed in the matrix. Then it's cleared. (It's a memory test, to prevent drunks from starting a computer.) I was looking at NSTimer, but it seemed simpler to do what I did. I'll look again. dkj P.S. And indeed, I'm not a real programmer: I just play one on TV. On 3 Sep, 2008, at 21:52, Graham Cox wrote: On 4 Sep 2008, at 2:40 pm, D.K. Johnston wrote: // wait 10 seconds NSUInteger i = 0, resume = time( nil ) + 10; while( i resume ) index = time( nil ); Don't do this! This is not a good way to wait for a period of time, even if waiting for a period of time were a good way to do what you want (which it isn't). All this does is chew up CPU time - events will still be captured and queued while this is running, so when it ends, they just get processed and passed to the now enabled control. Also, as posted the above code never terminates - i is never changed. What's to say your data display always takes 10 seconds anyway? Depends on the data, the machine you're running on, etc, etc... time delay loops are what a first-timer using BASIC uses - real programmers never do this. Disable the matrix at the start of data load. When the data load finishes, signal that fact to some object that re-enables the control. Load the data asynchronously (using a thread or timer- driven loop). hth, Graham ___ 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 [EMAIL PROTECTED]
Re: Selection in NSCollectionView
On Sep 3, 2008, at 5:19 PM, Quincey Morris wrote: But even after I tried to do something similar, I never got the collection to select things using the mouse, so I gave up. (It does work in IconCollection, but I couldn't find out why, or what was different.) That was the 3rd time I gave up trying to use NSCollectionView for something or other. I don't know about how to make this work with compound views - by that I mean views containing other standard Cocoa subviews. I can imagine things get considerably more difficult because those sub views all have their own event handling implemented (mouse, keyboard). I also failed to make this work in my early tests, if I remember correctly the hitTest thin never worked (I could be wrong - it was several months back). However, I have used NSCollectionView in conjunction with custom NSViews and selection is no problem. Basically there are two ways a view can get selected: 1) The selection state is change through the view's item controller. This usually happens when the selection indexes of the bound NSArrayController that controls the collection view's content change. The view has to be informed by its controller that it has been selected so it can update its visual state accordingly. This can be done by overwriting setSelected in the view's item controller. 2) An event in the view takes place that requires it to become selected or de-selected. This can be something like a -mouseDown: event, a keyboard event (if the view is can become and is firstResponder), probably not much else. In that case, the view informs its item controller (every view has its own controller) that it has been selected (or de-selected). The item controller forwards the information change to the collection view. After than (1) is what happens. For this to work you need to implement a custom NSCollectionViewItem subclass that overwrites -setSelected:. In there you first call super and then let the view know about the selection state (probably by giving the view its own -selected property). You will also need to overwrite -setRepresentedObject: and let the view know who its controller is (and possibly the represented object too): - (void)setSelected:(BOOL)flag { [super setSelected:flag]; // tell the view that it has been selected [(MyCustomView* )[self view] setSelected:flag]; } - (void)setRepresentedObject:(id)object { [super setRepresentedObject:object]; MyCustomView *view = (MyCustomView *)[self view]; [view setController:self]; [view setRepresentedObject:object]; } After that your NSView subclass knows both its controller object and the object it represents and it can forward events of interest to the item controller. Not sure if that brings you any closer to a solution for your problem. Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: NSOutlineView developer example
Ok, so here we go. When i build and run the developer example OutlineView i get an OutlineView with one / element and a triangle next to it, so i can browse the whole filesystem. In FileSystemItem.m there is a method: + (FileSystemItem *)rootItem { if (rootItem == nil) rootItem = [[FileSystemItem alloc] initWithPath:@/ parent:nil]; return rootItem; } so far so good. But when I change the initWithPath to initWithPath:@/Volumes/MyDisk/path/to/any/directory, as Ben said, i want the same behaviour like with the / only, but a tree from my path there. But this does not happen. Instead, i get a single row with the last path component with NO triange on the side, so this is kind of useless. Does anyone know why this happens? Thanks Boris Am 04.09.2008 um 01:35 schrieb Graham Cox: On 4 Sep 2008, at 3:42 am, Boris Prohaska wrote: but this still doesn't work Define doesn't work. If you expect help you have to be a lot more precise. What errors did you get? What are the symptoms? What have you tried? Remember that no-one is as interested in this problem as you - if you want to get answers, make the problem interesting! I'm guessing most people will read your question, say 'meh' and move on... hth, Graham ___ 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 [EMAIL PROTECTED]
clipView's boundsSize changes after scrollToPoint:
I have a clipView showing an NSTextView, the clipView is scaled. I see a weird behaviour where sometimes the clipView's bounds size changes after the scrollToPoint: gets called. The change in the bound's height in my case was from 392.66687 to 392.666809. This causes the document view kinda oscillate when scrolled to the bottom end. Any idea why the bounds size is getting changed? If i restore the boundsSize to the original value after calling scrollToPoint, scrolling behaves fine but this would be a tweak rather than a solution. I would appreciate any help. -Chaitanya ___ 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 [EMAIL PROTECTED]
Re: NSOutlineView developer example
so far so good. But when I change the initWithPath to initWithPath:@/Volumes/MyDisk/path/to/any/directory, as Ben said, i want the same behaviour like with the / only, but a tree from my path there. But this does not happen. Instead, i get a single row with the last path component with NO triange on the side, so this is kind of useless. Does anyone know why this happens? Erm... hi... The problem is not the root path itself, but the -fullPath method: - (NSString *)fullPath { return result = parent ? [[parent fullPath] stringByAppendingPathComponent:relativePath] : relativePath; } If the fullPath of the root item should be returned, this just returns its relative path. This works because for /, the full and the relative path are the same. If your root item should be /Users, the full path is /Users, but the above method returns just Users, therefore rendering all subsequent child item's paths useless. To get it working in a quick'n'dirty way, I tried the following (it works): 1) Add a new ivar called rootPath 2) In -initWithPath:parent: check whether the parten item passed is nil. If so, set the path passed as the rootPath 3) Modify the -fullPath method to look like this: - (NSString *)fullPath { return result = parent ? [[parent fullPath] stringByAppendingPathComponent:relativePath] : rootPath; } Marco ___ 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 [EMAIL PROTECTED]
What Size My Window?
For an ordinary window one can set in IB Auto Save Name: and everything works as expected. I can give it a nice size and position and the next time I open it, all is fine. But if this window is a document, controlled by some NSDocumentController, this Auto Save Name seems to be ingnored (at least on Tiger). This is annoying, as it forces me to size each new window again and again. Several solutions come to mind: 1. Have a FrameAutosaveName for each document Disadvantage: does not define a nice size for new documents. Clutters preferences. 2. Let the nib decide. (Current strategy). Disadvantage: if my definition of nice size differs from the nib, I have to resize each new document. 3. Use last changed/ moved window Disadvantage: if I want all windows in size A, but one special document in size B, then after this special document I have to resize the next one again to size A. 4. Have a menu: Use frontmost window as default size and position Disadvantage: menu clutter, clumsy. 5. Use the frontmost window Disadvantage: If I have one window with non-standard size, I must remember not to close it as the last one. 6. Other? So: is there some commonly agreed upon right strategy? Are there some official guidelines for document window sizes? Kind regards, Gerriet. ___ 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 [EMAIL PROTECTED]
Re: Creating a runloop to handle specific mouse events
On 03.09.2008, at 18:36, Berk Özer wrote: At one point, my application blocks the runloop and I have to poll for mouse events by calling [NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]. I'm not happy with the polling. It seems to me that creating a separate thread and configuring its runloop to process the events I'm interested in (specific mouse events for a specific window) is a more elegant solution. I couldn't find any example code doing that. I suspect that it's not possible for third-party developers to tap into the event stream coming from the window server, to create a CFRunloopSource similar to the one that feeds the main runloop. You can't really do that, because the GUI should always be driven from the main thread. Few parts of the GUI are thread-safe. Why do you have to block the runloop anyway? Have you thought about doing your work asynchronously or even in a second thread, and only doing the actual event handling and redraws in the main thread? PS - please do not reply to existing threads and change the subject line to create a new posting. That will sort your message under that old, completely unrelated thread in threaded view in most mail applications. Create a new message instead. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ 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 [EMAIL PROTECTED]
Re: Selection in NSCollectionView
On Sep 4, 2008, at 12:56 AM, Quincey Morris wrote: The IconCollection sample code doesn't do this. If you drag over the collection, you get a marquee rectangle that selects everything inside it. I see no code to do this (beyond the hitTest override at the individual view level), so I concluded that this behavior is in NSCollectionView itself. It is, the collection view updates the selection indexes and set its collection view items' selected states accordingly (in which order I don't know). The puzzling part was that I could find no way to enable this behavior in my own NSCollectionView, and I think that's (basically) what the OP was saying too. You get the marquee if you turn on multi-selection in the collection view. Otherwise, only one item can be selected and I can see why marquee selection makes little sense in that case. No doubt I missed something obvious, but considering that prototype NSCollectionItem bindings also appear to be broken currently, any time spent fiddling with NSCollectionView felt to me like a waste. Some things are broken (resizing will reset scroll bar positions, automatic scroll bars will confuse the control completely, key-view loop is broken, no control over animation). Before you suggest, I have reported those and got zero response from Apple. I seriously hope there is work going on behind those closed doors. It is a great control despite its deficiencies - for what I use it anyway. Regards Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: Why do all these methods of measuring string metrics with font attribute fail?
On 04.09.2008, at 03:57, an0 wrote: IMO, the size of a string with font attribute is an intrinsic property determined only by the string and the font(and the layout of the string on the view, but here let's fix the layout to one single line); and the view used to render the attributed string should have a reasonalby bigger size to hold the whole string. In other words, one could have a good guess of the view size from the attributed string size. Well, this is programming, we try not to guess too much. It's much better design to ask the object that actually does all the drawing to tell you how much room it will take. Consider an NSTextFieldCell: It can have no borders, rounded ends (in which case the distance from the left and right edges to the actual text will be larger than that to the top and bottom, to accomodate the half-circles), rectangular border... If this measuring was done by string dimensions and a reasonable guess, it'd mean if you realize field X should really have rounded ends instead of straight ones, you'd have to change your measuring code everywhere you do your reasonable guess. On the other hand, the NSTextFieldCell knows how it has to be configured, and it knows what algorithm to use for its current appearance and content. It has to, or it wouldn't be able to draw itself. Why duplicate this logic elsewhere? A cell is a lightweight object intended to encapsulate text drawing, selection and editing, and creating one and keeping it around means your drawings will be much faster, because state and previous results of measurements can be cached in the NSTextFieldCell for faster drawing. That said, while Cocoa has a convenience method for drawing a string in a rect in NSStringDrawing.h, there's none for measuring it. You could roll your own according to this article: http://www.zathras.de/blog-cocoa-text-system-everywhere.htm but for best performance you'd want to cache the three text system objects you created for this (the NSStringDrawing methods can't really do much cacheing, though I've heard they try their best given their lack of information), and that's what an NSTextFieldCell probably does anyway, so why bother? Just use the cell class for your string measuring and drawing. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ 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 [EMAIL PROTECTED]
Re: What Size My Window?
On 04.09.2008, at 10:10, Gerriet M. Denkmann wrote: 6. Other? So: is there some commonly agreed upon right strategy? Are there some official guidelines for document window sizes? You can save the size of your window in some plist in your document using -stringWithSavedFrame and restore it using -setFrameFromString:. That would be per-document. The one issue this has is that the user would have to save the document each time to make this stick. So just moving a window dirties the document. It's a little hard to do this using an NSDocument, but a common approach is to use a resource or xattributes to attach the window positions to a file without touching the actual document. That way, diff and similar tools won't think it's changed, and if the position gets lost during internet transfer, that's not too bad, as it's not vital information. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ 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 [EMAIL PROTECTED]
Re: NSNotificationCenter removeObserver NOT working
Hi Valentin, I think you're hoping that passing nil for the observer acts as a wildcard? It does not, check the docs. Observer to remove from the dispatch table. Specify an observer to remove only entries for this observer. Must not be nil, or message will have no effect. -Ken On Thu, Sep 4, 2008 at 2:51 AM, Valentin Dan [EMAIL PROTECTED] wrote: Hi, I'm trying to remove all notifications that have a certain object and I can't seem to get that to work. I'm doing something like this: [[NSNotificationCenter defaultCenter] removeObserver:nil name:nil object:myObject]; The notifications for this sender keep coming and that causes a problem. How can I fix that ? Thanks! ___ Valentin Dan, Software Developer Direct: +1 905 886 1833 ext.3047 Email: [EMAIL PROTECTED] Office: +40 356-710158 Masstech Group Inc. Fax:+40 256-220912 http://www.masstechgroup.com http://www.masstechgroup.com/ THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU. ___ 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/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: NSMatrix mouse puzzle
On 4 Sep 2008, at 4:14 pm, D.K. Johnston wrote: The reason I want a delay is that the user is supposed to have 10 seconds only to look at the data displayed in the matrix. Then it's cleared. (It's a memory test, to prevent drunks from starting a computer.) I was looking at NSTimer, but it seemed simpler to do what I did. I'll look again. NSTimer is ideal for this - just set it to have a value of 10 seconds and not to repeat. In the callback, re-enable the matrix. cheers, Graham ___ 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 [EMAIL PROTECTED]
Re: NSPanel: resigning key focus?
On 4 Sep 2008, at 8:26 pm, Vijay Malhan wrote: How do I make NSPanel(activating utility window) to resign key focus on an event (escape key down). I have tried: - resignFirstResponder - resignKeyWindow etc. None works. I have sub-classed NSPanel to get keydown events. This won't work because it doesn't know who should become the responder when it resigns. Instead, if you make some other object (window) key, this one should lose that status. (i.e. it can only jump if it has somewhere *to* jump). hth, Graham ___ 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 [EMAIL PROTECTED]
Re: Creating a runloop to handle specific mouse events
It's a big legacy app. Refactoring the blocking routines into separate threads is major work. So I was wondering if I could kind of reverse the concept by controlling which events get channelled to which thread. The rendering functionality of the window server wouldn't need to be thread-safe. Only the access to the event queue. Of course, I must not issue any display commands from within the secondary threads. At the moment, polling works for me. I'm just curious about alternative solutions. Regs. Berk On Sep 4, 2008, at 10:26 AM, Uli Kusterer wrote: On 03.09.2008, at 18:36, Berk Özer wrote: At one point, my application blocks the runloop and I have to poll for mouse events by calling [NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]. I'm not happy with the polling. It seems to me that creating a separate thread and configuring its runloop to process the events I'm interested in (specific mouse events for a specific window) is a more elegant solution. I couldn't find any example code doing that. I suspect that it's not possible for third-party developers to tap into the event stream coming from the window server, to create a CFRunloopSource similar to the one that feeds the main runloop. You can't really do that, because the GUI should always be driven from the main thread. Few parts of the GUI are thread-safe. Why do you have to block the runloop anyway? Have you thought about doing your work asynchronously or even in a second thread, and only doing the actual event handling and redraws in the main thread? PS - please do not reply to existing threads and change the subject line to create a new posting. That will sort your message under that old, completely unrelated thread in threaded view in most mail applications. Create a new message instead. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ 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 [EMAIL PROTECTED]
(no subject)
Hi All, I need to create a plug-in for safari. It should be a toolbar and when I'm installing it, it has to a prompt user to enter personal info and should be stored in same computer. When I'm using browser, where I need to fill the data on form fields. I have one more thing, when I am clicking on toolbar icon, it should auto populate data on appropriate fields. How can I do it ? From where I should start ?. Thanks in advance ___ 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 [EMAIL PROTECTED]
Re: NSPanel: resigning key focus?
This won't work because it doesn't know who should become the responder when it resigns. Instead, if you make some other object (window) key, this one should lose that status. (i.e. it can only jump if it has somewhere *to* jump). The next object in responder chain should become first responder. If there is a document window open, then it should become the first responder or the application itself. The panel should change it's state as deactivated. What I am trying to do here is to allow application to listen the key events after hitting the escape key on the activated panel. If the panel is active it takes the key events which is the correct behavior. But if user wants to use some application shortcuts (specially single key shortcuts), it conflicts with let's say look-ahead/key-selection feature on a Table view on NSPanel. ___ 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 [EMAIL PROTECTED]
Re: NSPanel: resigning key focus?
This won't work because it doesn't know who should become the responder when it resigns. Instead, if you make some other object (window) key, this one should lose that status. (i.e. it can only jump if it has somewhere *to* jump). The next object in responder chain should become first responder. If there is a document window open, then it should become the first responder or the application itself. The panel should change it's state as deactivated. What I am trying to do here is to allow application to listen the key events after hitting the escape key on the activated panel. If the panel is active it takes the key events which is the correct behavior. But if user wants to use some application shortcuts (specially single key shortcuts), it conflicts with let's say look-ahead/key-selection feature on a Table view on NSPanel. If I do: [window orderOut: nil]; [window orderFront: nil]; // Not asking it to be key This results in the behavior I am trying to achieve. But this workaround will not work as there is a flicker (ordering out and ordering in). I was expecting similar behavior with [window resignFirstResponder]. ___ 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 [EMAIL PROTECTED]
Changing the model behind contoller's back?
I am experimenting with Core Data model bound to NSTreeController bound to a custom view. When I change the model via controller like this: Widget* newWidget = [NSEntityDescription insertNewObjectForEntityForName:@Widget inManagedObjectContext:[self managedObjectContext]]; NSUInteger path[2] = {0, 0}; [widgetTreeController insertObject:newWidget atArrangedObjectIndexPath:[NSIndexPath indexPathWithIndexes:path length:2]]; then the custom view receives a change notification via its binding, but when I modify the model directly, [[self rootWirdget] addChildWidgetsObject:newWidget]; where addChildWidgetsObject: is a dynamic mutator accessor, i.e. there's only declaration in my project, and the implementation is provided by Core Data. then the binding in the custom view is not fired. The question is: am I allowed to alter the model directly, or should I always use the controller? I think that I should be allowed to alter the model directly, because the model can be manipulated via Apple Script etc. But what can be the problem then? ___ 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 [EMAIL PROTECTED]
Re: (no subject)
On 4 Sep 2008, at 12:54, [EMAIL PROTECTED] wrote: Hi All, I need to create a plug-in for safari. It should be a toolbar and when I'm installing it, it has to a prompt user to enter personal info and should be stored in same computer. When I'm using browser, where I need to fill the data on form fields. I have one more thing, when I am clicking on toolbar icon, it should auto populate data on appropriate fields. How can I do it ? From where I should start ?. As far as I know, you can't add toolbars to Safari. At a guess, this is by design. Bob ___ 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 [EMAIL PROTECTED]
NSProgressIndicator drawing
I'm using a NSProgressIndicator in my interface, but it shows some strange edges around it when it is visible. The progress indicator is superimposed over a background picture (which is loaded by a the view as background). What am I doing wrong here? inline: Picture 3.png Regards / Met vriendelijke groet, Marcel___ 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 [EMAIL PROTECTED]
Re: NSProgressIndicator drawing
Are you making the progress indicator a subview of the picture? If not, that would explain your screenshot. On 4 Sep 2008, at 13:29, Marcel Borsten wrote: I'm using a NSProgressIndicator in my interface, but it shows some strange edges around it when it is visible. The progress indicator is superimposed over a background picture (which is loaded by a the view as background). What am I doing wrong here? Picture 3.png Regards / Met vriendelijke groet, Marcel___ 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/cocoadev%40mikeabdullah.net This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Bluetooth disconnect WiFi
I have PowerBook G4 and PowerPC. In Xcode and Obj - C, I use IOBluetooth.framework. Why when bluetooth is working WIFI connection is interrupted, and sometimes quits working. May be both devices use one and the same antenna or use the same frequency? Is there a way out? Вы уже с Yahoo!? Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.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 [EMAIL PROTECTED]
Re: Why do all these methods of measuring string metrics with font attribute fail?
On Thu, Sep 4, 2008 at 11:33 AM, Peter Ammon [EMAIL PROTECTED] wrote: On Sep 3, 2008, at 6:01 AM, an0 wrote: I should declare up front that I know there are some arcane ways to measure string metrics using things like NSTextStorage, NSLayoutManager and the kin. Given the string and the font used to render it, it is reasonable there should be some straightforward way to tell the metrics of the string when laid out in one line. Actually, I thought I'd found several after reading through the docs; however, all of them turned out to be very miserable. Here goes what I've tried, with the effects in comments: Then what about boundingRectForFont? Why is it so large? NSFont *font = [NSFont labelFontOfSize:12]; // I put the string in a label NSRect fontRect = [font boundingRectForFont]; // too large This is measuring how much space it would take to render any single glyph. This isn't what you want for measuring text. NSRect glyphRect = [font boundingRectForGlyph:'W']; // too too small Glyphs are not the same thing as characters, and you cannot pass one in place of the other. The ASCII value of a character is not related to its glyph value. For example, the glyph corresponding to W would be 58 in the font you were using. Using 58 for 'W' seems to make no difference here, the resulting glyph height is still unreasonably small. (In fact, you should not think about glyph value of a character at all. Some characters have no glyphs, like space; sometimes multiple characters produce a single glyph, like an fi ligature.) In order to generate glyphs from characters, you should use the methods in NSLayoutManager. However, as you know, this is overkill for simple text measurements. IMO, the size of a string with font attribute is an intrinsic property determined only by the string and the font(and the layout of the string on the view, but here let's fix the layout to one single line); and the view used to render the attributed string should have a reasonalby bigger size to hold the whole string. In other words, one could have a good guess of the view size from the attributed string size. So, if my understanding of these two metrics is right, how can they differ so much? Was I using the wrong APIs? If my understanding is wrong, can you tell me what's the exact relationship between these two metrics? You were using the wrong APIs. To find the size of a string, use -[string sizeWithAttributes:]. To find the natural size of a control whose content is some string, use -[[textField cell] cellSize]. As you surmised, the control's natural size is often reasonably bigger than the content - but it may not be, if the control is fixed size (such as a circular button). So, it seems -[string sizeWithAttributes:] is the only API that gives a reasonable size of string. But I'm wondering what all the other APIs listed above are for. If they give no useful information for application programmers, why does Apple expose them to confuse us? If you just want a control to be big enough for its content, set the content on the control and then call -[control sizeToFit]. Hope this helps, -Peter ___ 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 [EMAIL PROTECTED]
Re: [NSTableView] Drag and Drop issues with NSButton in Leopard
On Sep 3, 2008, at 12:27 AM, Corbin Dunn wrote: On Sep 2, 2008, at 1:59 PM, Stéphane Sudre wrote: I have some code that works OK on Tiger but does not on Leopard. I have a NSTableView with a column whose data cell is a NSButtonCell subclass. The NSButtonCell is set to be a checkbox/switchbox. The subclass implements the following method: - (BOOL) trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)flag { return YES; } in order to prevent clicks to be taken into account. On Mac OS X 10.4.x, this works perfectly: you can't click the checkbox to change its value but you can initiate a drag by clicking on the checkbox. On Mac OS X 10.5.x, this prevents the click but does not allow the drag operation to begin. I've tried to play with the new NSTableViews methods in Leopard to deal with advanced tracking but this did not help. Either it's a regression or I'm not doing something correctly (I just hope it's the second case). What could be done to make this work on Leopard? The release notes should have covered this, but you want to implement this in 10.5 (only required if you are linking against 10.5 or higher): I'm linking against 10.4 when developing on Tiger and against 10.5 when developing on Leopard. So I'm in the only case. [...] Return anything except trackable. This fixes it? It does. Thanks. ___ 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 [EMAIL PROTECTED]
Re: (no subject)
On Thu, Sep 4, 2008 at 7:57 AM, Thomas Davie [EMAIL PROTECTED] wrote: As far as I know, you can't add toolbars to Safari. At a guess, this is by design. ... and a very GOOD design, too: http://blogs.walkerart.org/newmedia/wp-content/uploads/2008/07/too-many-toolbars.jpg (just one example) ;-) -- I.S. ___ 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 [EMAIL PROTECTED]
Re: Why do all these methods of measuring string metrics with font attribute fail?
On 4 Sep 2008, at 11:27 pm, an0 wrote: If they give no useful information for application programmers, Yes they do, but perhaps just not for your application. If you want to use glyphs as a graphic element for example, it's sometimes useful to query these sizes without having to try laying them out as text. Remember, there is a big difference, conceptually, between a string (a collection of characters) and a font (a collection of glyphs). Glyphs are graphical entities, and most of the stuff in NSFont and NSFontManager is there to support these concepts at that level. Your problem (and confusion) appears to stem from the fact that you seem to think that a font is something like a string, and so can be treated as a collection of characters. The layout of glyphs to form an image of a string of text on the screen is a complex process, and applications that do this need to know all sorts of metrics beyond how much space does this string occupy. In fact to calculate that they need to add up the space occupied by each glyph, and some of the methods you mentioned are there to support that sort of processing. cheers, Graham ___ 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 [EMAIL PROTECTED]
Re: NSProgressIndicator drawing
The picture is drawn in a custom view with: [[NSColor colorWithPatternImage:image] set]; I don't think I can load the NSProgressIndicator as a subview in this way, so I am going to look at getting the image there in another way. Regards Marcel On 4 sep 2008, at 14:58, Mike Abdullah wrote: Are you making the progress indicator a subview of the picture? If not, that would explain your screenshot. On 4 Sep 2008, at 13:29, Marcel Borsten wrote: I'm using a NSProgressIndicator in my interface, but it shows some strange edges around it when it is visible. The progress indicator is superimposed over a background picture (which is loaded by a the view as background). What am I doing wrong here? Picture 3.png Regards / Met vriendelijke groet, Marcel___ 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/cocoadev%40mikeabdullah.net This email sent to [EMAIL PROTECTED] smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: understanding conversions between CF and NS datatypes
Am Sa,30.08.2008 um 05:22 schrieb Michael Ash: On Fri, Aug 29, 2008 at 1:38 PM, Allen Curtis [EMAIL PROTECTED] wrote: 1. Where can I get a better understanding of the data conversion between these different frameworks? 2. Ultimately the device path names will appear in a ComboBox. Was it necessary to convert the CFMutableArray to a NSMutableArray for the datasource function? Ultimately the most important thing to understand about toll-free bridging (the link between CF and NS data types) is that you don't have to convert anything. You *can't* convert anything. Because they aren't two different things. An NSArray *is* a CFArray. An NSMutableArray is a CFMutableArray. They are just two different names for the same type. I'm not sure, whether this is completly correct. I would prefer to say, that are two different names of two different types, which are interchangeable. But AFAIK in some (rare) cases, CF and NS behaves differently. I know this example CFArrayCreateMutable Creates a new empty mutable array. … capacity *The maximum number of values that can be contained* by the new array. The array starts empty and can grow to this number of values (and it can have less). If this parameter is 0, the array’s maximum capacity is not limited. The value must not be negative. … arrayWithCapacity: … numItems The *initial capacity* of the new array. … Discussion Mutable arrays *expand as needed*; numItems simply establishes the object’s initial capacity. So, if you get an CFMutableArray and cast it to an NSMutableArray you will get unintended results on inserting behind the capacity. Cheers, Amin It gets slightly tricky because the compiler doesn't know this crucial fact. So when you have a CFMutableArrayRef and you try to treat it like it was an NSMutableArray*, the compiler gets complainey. So you have to do some fancy typecasting to shut it up. But it's very important to understand that this typecast doesn't do any sort of conversion or translation or anything of the sort, it just tells the compiler to look at the exact same pointer to the exact same object in a new light. 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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: understanding conversions between CF and NS datatypes
Am Do,04.09.2008 um 16:41 schrieb Negm-Awad Amin: Am Sa,30.08.2008 um 05:22 schrieb Michael Ash: On Fri, Aug 29, 2008 at 1:38 PM, Allen Curtis [EMAIL PROTECTED] wrote: 1. Where can I get a better understanding of the data conversion between these different frameworks? 2. Ultimately the device path names will appear in a ComboBox. Was it necessary to convert the CFMutableArray to a NSMutableArray for the datasource function? Ultimately the most important thing to understand about toll-free bridging (the link between CF and NS data types) is that you don't have to convert anything. You *can't* convert anything. Because they aren't two different things. An NSArray *is* a CFArray. An NSMutableArray is a CFMutableArray. They are just two different names for the same type. I'm not sure, whether this is completly correct. I would prefer to say, that are two different names of two different types, which are interchangeable. But AFAIK in some (rare) cases, CF and NS behaves differently. I know this example CFArrayCreateMutable Creates a new empty mutable array. … capacity *The maximum number of values that can be contained* by the new array. The array starts empty and can grow to this number of values (and it can have less). If this parameter is 0, the array’s maximum capacity is not limited. The value must not be negative. … arrayWithCapacity: … numItems The *initial capacity* of the new array. … Discussion Mutable arrays *expand as needed*; numItems simply establishes the object’s initial capacity. So, if you get an CFMutableArray and cast it to an NSMutableArray you will get unintended results on inserting behind the capacity. Cheers, Amin Oh, I tried it (Casting an CFMutableArray to an NSMutablearray and send masses of -addObject: to it) and did not get an error? Can somebody explain that? Cheers, Amin It gets slightly tricky because the compiler doesn't know this crucial fact. So when you have a CFMutableArrayRef and you try to treat it like it was an NSMutableArray*, the compiler gets complainey. So you have to do some fancy typecasting to shut it up. But it's very important to understand that this typecast doesn't do any sort of conversion or translation or anything of the sort, it just tells the compiler to look at the exact same pointer to the exact same object in a new light. 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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ 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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: Preference panes and Apple Help
On Wed, 03 Sep 2008 09:27:05 +1000, Andrew White [EMAIL PROTECTED] said: PS: I couldn't see any call to deallocate a FSRef. Does it get correctly cleaned up as part of normal stack cleanup? Andrew: Yes. :) Look in Files.h. Despite the Ref ending on the name (legacy), an FSRef is not a pointer; it's just a struct. Objective-C is C. Therefore this is an ordinary local variable; the 80 bytes on the stack are cleaned up when the variable goes out of scope. m. -- matt neuburg, phd = [EMAIL PROTECTED], http://www.tidbits.com/matt/ A fool + a tool + an autorelease pool = cool! One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf AppleScript: the Definitive Guide - Second Edition! http://www.amazon.com/gp/product/0596102119 ___ 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 [EMAIL PROTECTED]
Re: Why do all these methods of measuring string metrics with font attribute fail?
I know the difference between string and font, and that between grapheme and glyph. However, I might miss the point that the size of the rendered string is not simply the sum the sizes of individual glyphs. There should be some extra space taken by spacing among and around glyphs. And some other more subtle typesetting details, also. Thanks for your hint, anyhow. On Thu, Sep 4, 2008 at 10:05 PM, Graham Cox [EMAIL PROTECTED] wrote: On 4 Sep 2008, at 11:27 pm, an0 wrote: If they give no useful information for application programmers, Yes they do, but perhaps just not for your application. If you want to use glyphs as a graphic element for example, it's sometimes useful to query these sizes without having to try laying them out as text. Remember, there is a big difference, conceptually, between a string (a collection of characters) and a font (a collection of glyphs). Glyphs are graphical entities, and most of the stuff in NSFont and NSFontManager is there to support these concepts at that level. Your problem (and confusion) appears to stem from the fact that you seem to think that a font is something like a string, and so can be treated as a collection of characters. The layout of glyphs to form an image of a string of text on the screen is a complex process, and applications that do this need to know all sorts of metrics beyond how much space does this string occupy. In fact to calculate that they need to add up the space occupied by each glyph, and some of the methods you mentioned are there to support that sort of processing. cheers, Graham ___ 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 [EMAIL PROTECTED]
Re: Creating a runloop to handle specific mouse events
At one point, my application blocks the runloop and I have to poll for mouse events by calling [NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:]. I'm not happy with the polling. It seems to me that creating a separate thread and configuring its runloop to process the events I'm interested in (specific mouse events for a specific window) is a more elegant solution. I couldn't find any example code doing that. I suspect that it's not possible for third-party developers to tap into the event stream coming from the window server, to create a CFRunloopSource similar to the one that feeds the main runloop. This isn’t really polling as much as taking over the runloop and filtering out some events. There’s nothing really inelegant about this— it’s the call that powers the tracking loop in most of the controls in AppKit. If you really wanted, you could shuffle off the events to another thread for processing later. -Ben___ 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 [EMAIL PROTECTED]
Re: What Size My Window?
On 4 Sep 2008, at 15:48, Ken Thomases wrote: On Sep 4, 2008, at 3:10 AM, Gerriet M. Denkmann wrote: For an ordinary window one can set in IB Auto Save Name: and everything works as expected. I can give it a nice size and position and the next time I open it, all is fine. But if this window is a document, controlled by some NSDocumentController, this Auto Save Name seems to be ingnored (at least on Tiger). This is annoying, as it forces me to size each new window again and again. This is a bug in NSWindowController that's fixed in Leopard. Search for New Behavior for NSWindowController Frame Autosave Names in the Leopard AppKit release notes http:// developer.apple.com/releasenotes/Cocoa/AppKit.html. You can work around it using -[NSWindowController setWindowFrameAutosaveName:]. I did: - (void)windowControllerDidLoadNib:(NSWindowController *) aController { [super windowControllerDidLoadNib:aController]; [ aController setWindowFrameAutosaveName: DocumentWindowName ]; } It works - but not as I was expecting it to work: It sets (and remembers) the size/position of the first window. But all subsequent windows will get the position from the nib and their size is never remembered. This is (for my taste at least) much better: - (void)windowControllerDidLoadNib:(NSWindowController *) aController { [super windowControllerDidLoadNib:aController]; [ myWindow setFrameUsingName: DocumentWindowName ]; windowControllerHasLoadedNib = YES; } // document is delegate for only its own window: - (void)windowDidResize:(NSNotification *)aNotification { if ( windowControllerHasLoadedNib ) [ myWindow saveFrameUsingName: DocumentWindowName ]; } same for windowDidMove:. Kind regards, Gerriet. ___ 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 [EMAIL PROTECTED]
Re: understanding conversions between CF and NS datatypes
On 8/29/08 10:38 AM, Allen Curtis said: I am writing a Cocoa application for accessing a serial device. (IOKit) In order to do this, you need to translate between CF and NS data types. (I believe) You could probably make use of the AMSerialPort class (google it) to make thing a lot easier. -- Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ 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 [EMAIL PROTECTED]
Re: understanding conversions between CF and NS datatypes
On Thu, Sep 4, 2008 at 10:41 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Am Sa,30.08.2008 um 05:22 schrieb Michael Ash: Ultimately the most important thing to understand about toll-free bridging (the link between CF and NS data types) is that you don't have to convert anything. You *can't* convert anything. Because they aren't two different things. An NSArray *is* a CFArray. An NSMutableArray is a CFMutableArray. They are just two different names for the same type. I'm not sure, whether this is completly correct. I would prefer to say, that are two different names of two different types, which are interchangeable. No, they are the same type. But AFAIK in some (rare) cases, CF and NS behaves differently. Meaningless. You can subclass NSArray and get whatever behavior you want. The result is still an NSArray (and still a CFArray). 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 [EMAIL PROTECTED]
Re: NSProgressIndicator drawing
2008/9/4 Marcel Borsten [EMAIL PROTECTED]: I'm using a NSProgressIndicator in my interface, but it shows some strange edges around it when it is visible. The progress indicator is superimposed over a background picture (which is loaded by a the view as background). What am I doing wrong here? Looks like the problem described in the last paragraph here: http://www.cocoadev.com/index.pl?DrawRect 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 [EMAIL PROTECTED]
Can I get a FILE* from Cocoa (NSFileHandle )?
I have gotten some suggestions on a problem which require access to standard C calls. In particular, one poster suggested that I use some calls which require a FILE*, when all I have at this point are NSTask, NSPipe, and NSFileHandle objects. Is it possible to get a FILE* from an NSPipe or NSFileHandle? I don't see anything in the documentation that looks like that. (I am not getting much help from Google either.) ___ 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 [EMAIL PROTECTED]
Re: Can I get a FILE* from Cocoa (NSFileHandle )?
Le 4 sept. 08 à 19:09, Paul Archibald a écrit : I have gotten some suggestions on a problem which require access to standard C calls. In particular, one poster suggested that I use some calls which require a FILE*, when all I have at this point are NSTask, NSPipe, and NSFileHandle objects. Is it possible to get a FILE* from an NSPipe or NSFileHandle? I don't see anything in the documentation that looks like that. (I am not getting much help from Google either.) fdopen[[fileHandle fileDescriptor], ...) See man fdopen for details. ___ 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 [EMAIL PROTECTED]
Re: Can I get a FILE* from Cocoa (NSFileHandle )?
On Sep 4, 2008, at 10:09 AM, Paul Archibald wrote: I have gotten some suggestions on a problem which require access to standard C calls. In particular, one poster suggested that I use some calls which require a FILE*, when all I have at this point are NSTask, NSPipe, and NSFileHandle objects. Which calls and what problem are they trying to solve? Is it possible to get a FILE* from an NSPipe or NSFileHandle? I don't see anything in the documentation that looks like that. (I am not getting much help from Google either.) It's pretty unlikely that you can map stdio FILE to a NSFileHandle. NSFileHandle does offer the -fileDescriptor method, which is the underlying object that both FILE and NSFileHandle are built on top of. NSPipe has similar methods. Maybe you can use some calls that work at that level? -- Dave Carrigan [EMAIL PROTECTED] Seattle, WA, USA PGP.sig Description: This is a digitally signed message part ___ 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 [EMAIL PROTECTED]
Re: understanding conversions between CF and NS datatypes
Am Do,04.09.2008 um 18:27 schrieb Michael Ash: On Thu, Sep 4, 2008 at 10:41 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Am Sa,30.08.2008 um 05:22 schrieb Michael Ash: Ultimately the most important thing to understand about toll-free bridging (the link between CF and NS data types) is that you don't have to convert anything. You *can't* convert anything. Because they aren't two different things. An NSArray *is* a CFArray. An NSMutableArray is a CFMutableArray. They are just two different names for the same type. I'm not sure, whether this is completly correct. I would prefer to say, that are two different names of two different types, which are interchangeable. No, they are the same type. But AFAIK in some (rare) cases, CF and NS behaves differently. Meaningless. You can subclass NSArray and get whatever behavior you want. The result is still an NSArray (and still a CFArray). Mike But I wouldn't say, that a subclass of a baseclass is the same type as the baseclass. You can assign a subclass instacne to a baseclass pointer and there is no casting, so indeed the situation is similiar to NSArray and CFArray. But saying, that assigning proves the type identity (correct word?) … Cheers, Amin ___ 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/negm-awad%40cocoading.de This email sent to [EMAIL PROTECTED] Amin Negm-Awad [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Re: Can I get a FILE* from Cocoa (NSFileHandle )?
Naturally as soon as I posted my query I noticed that there was a method I had not paid any attention to, and, of course, that is the one Jean-Daniel and Robert already knew about, and have been kind enough to point out to me. Thanks guys, I will be testing this out next. Regards, Paul On Sep 4, 2008, at 10:18 AM, Jean-Daniel Dupas wrote: Le 4 sept. 08 à 19:09, Paul Archibald a écrit : I have gotten some suggestions on a problem which require access to standard C calls. In particular, one poster suggested that I use some calls which require a FILE*, when all I have at this point are NSTask, NSPipe, and NSFileHandle objects. Is it possible to get a FILE* from an NSPipe or NSFileHandle? I don't see anything in the documentation that looks like that. (I am not getting much help from Google either.) fdopen[[fileHandle fileDescriptor], ...) See man fdopen for details. Get a fileDescriptor from your NSFileHandle object, then fdopen it to get a FILE*. ___ 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 [EMAIL PROTECTED]
Re: understanding conversions between CF and NS datatypes
On Thu, Sep 4, 2008 at 1:40 PM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Am Do,04.09.2008 um 18:27 schrieb Michael Ash: On Thu, Sep 4, 2008 at 10:41 AM, Negm-Awad Amin [EMAIL PROTECTED] wrote: Am Sa,30.08.2008 um 05:22 schrieb Michael Ash: Ultimately the most important thing to understand about toll-free bridging (the link between CF and NS data types) is that you don't have to convert anything. You *can't* convert anything. Because they aren't two different things. An NSArray *is* a CFArray. An NSMutableArray is a CFMutableArray. They are just two different names for the same type. I'm not sure, whether this is completly correct. I would prefer to say, that are two different names of two different types, which are interchangeable. No, they are the same type. But AFAIK in some (rare) cases, CF and NS behaves differently. Meaningless. You can subclass NSArray and get whatever behavior you want. The result is still an NSArray (and still a CFArray). But I wouldn't say, that a subclass of a baseclass is the same type as the baseclass. You can assign a subclass instacne to a baseclass pointer and there is no casting, so indeed the situation is similiar to NSArray and CFArray. Subclassing is supposed to be an is a relationship. In other words, if I subclass NSMutableArray and call the new class a MyMutableArray, then a MyMutableArray is an NSMutableArray. An NSMutableArray is in turn an NSArray, and an NSArray is an NSObject. Likewise, an NSArray is a CFArray, and a CFArray is an NSArray. They are just two different names for the same thing. The fact that you can obtain different behaviors depending on how you create them is not all that interesting, as that happens *anyway* with many different classes. But saying, that assigning proves the type identity (correct word?) … Not sure what you mean here. 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 [EMAIL PROTECTED]
Re: NSNotificationCenter removeObserver NOT working
On Sep 4, 2008, at 3:02 AM, Valentin Dan wrote: Oh, yeah ... I didn't read that part. I would have been easier though if it had acted like a wildcard :-) It would also be extremely problematic. You have no way of knowing what else might be observing that particular notification, nor what might break if you unregister observers willy-nilly. b.bum smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
On Thu, Sep 4, 2008 at 3:14 PM, John Murphy [EMAIL PROTECTED] wrote: I need to know how to create a line break in Interface Builder. \n does not work... I have a multiline text field that is populated using bindings, the value is modified using a display pattern: %{value1}@ %{value2}@ I need a line break between these two values. Any ideas? If inserting a \n escape doesn't work, my next idea would be to create a dependent key (dependent on whatever key you were original trying to bind) that gives the proper formatted string. Say you wanted to bind to two keys called: foo and bar. Create a third key formattedFooBarString (or whatever) and register it as dependent upon foo and bar (so that if either foo or bar change, foormattedFooBarString is also updated). The key has no setter, but its getter returns: return [NSString stringWithFormat:@[EMAIL PROTECTED]@, [self valueForKey:@foo], [self valueForKey:@bar]]; You then bind to foormattedFooBarString (without using the display pattern) and it should work fine. I hope this helps. -- I.S. ___ 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 [EMAIL PROTECTED]
Notify when file moved
I have a pref pane and a background app tied to it. Sometimes, people try to trash the pref pane while the background process is running which orphans things a bit. Is there a way to have the background process notified when the pref pane is moved (ie moved to the trash). Note the background process resides in the pref pane bundle. Thanks, Trygve ___ 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 [EMAIL PROTECTED]
Re: Notify when file moved
Is there a way to have the background process notified when the pref pane is moved (ie moved to the trash). Google FSEvents Framework (Leopard only). For pre-Leopard, google BDAlias. -- I.S. ___ 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 [EMAIL PROTECTED]
Re: Creating a runloop to handle specific mouse events
On 04.09.2008, at 17:04, Benjamin Stiglitz wrote: This isn’t really polling as much as taking over the runloop and filtering out some events. There’s nothing really inelegant about this—it’s the call that powers the tracking loop in most of the controls in AppKit. If you really wanted, you could shuffle off the events to another thread for processing later. Also, if you use the run loop correctly, it will block until your timeout is hit. Which is much more well-behaved than busy-polling. OTOH, I hope you're not getting GUI events on that run loop like mouse clicks, because I don't think that's supported from multiple threads, so you may get odd crashes doing that. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
This was actually my first thought as well, but I was hoping to avoid this technique because I am using this as part of a tutorial I want to remain in Interface Builder as much as possible for this particular lesson. --- On Thu, 9/4/08, I. Savant [EMAIL PROTECTED] wrote: From: I. Savant [EMAIL PROTECTED] Subject: Re: line break in Interface Builder To: [EMAIL PROTECTED] Cc: Cocoa-dev@lists.apple.com Date: Thursday, September 4, 2008, 7:20 PM On Thu, Sep 4, 2008 at 3:14 PM, John Murphy [EMAIL PROTECTED] wrote: I need to know how to create a line break in Interface Builder. \n does not work... I have a multiline text field that is populated using bindings, the value is modified using a display pattern: %{value1}@ %{value2}@ I need a line break between these two values. Any ideas? If inserting a \n escape doesn't work, my next idea would be to create a dependent key (dependent on whatever key you were original trying to bind) that gives the proper formatted string. Say you wanted to bind to two keys called: foo and bar. Create a third key formattedFooBarString (or whatever) and register it as dependent upon foo and bar (so that if either foo or bar change, foormattedFooBarString is also updated). The key has no setter, but its getter returns: return [NSString stringWithFormat:@[EMAIL PROTECTED]@, [self valueForKey:@foo], [self valueForKey:@bar]]; You then bind to foormattedFooBarString (without using the display pattern) and it should work fine. I hope this helps. -- I.S. ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
On Sep 4, 2008, at 12:14, John Murphy wrote: I need to know how to create a line break in Interface Builder. \n does not work... I have a multiline text field that is populated using bindings, the value is modified using a display pattern: %{value1}@ %{value2}@ I need a line break between these two values. Any ideas? Option-Return? ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
On Thu, Sep 4, 2008 at 3:26 PM, John Murphy [EMAIL PROTECTED] wrote: This was actually my first thought as well, but I was hoping to avoid this technique because I am using this as part of a tutorial I want to remain in Interface Builder as much as possible for this particular lesson. That's unfortunate. :-) -- I.S. ___ 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 [EMAIL PROTECTED]
Disabled NSButton
Hi All! I am implementing a login panel. I would like to have 'Ok' button disabled as long as the password field is empty. Any advise? R. ___ 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 [EMAIL PROTECTED]
RE: NSNotificationCenter removeObserver NOT working
Actually I kind of read it but not the right documentation ... in my X-Code (2.4.1) documentation it says it can be used as nil. Only the documentation on the web says otherwise ... ___ Valentin Dan, Software Developer Direct: +1 905 886 1833 ext.3047 Email: [EMAIL PROTECTED] Office: +40 356-710158 Masstech Group Inc. Fax:+40 256-220912 http://www.masstechgroup.com http://www.masstechgroup.com/ THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU. From: Valentin Dan Sent: Thursday, September 04, 2008 1:03 PM To: 'Ken Ferry' Cc: cocoa-dev@lists.apple.com; Dan Tascau; Tim Rodgers Subject: RE: NSNotificationCenter removeObserver NOT working Oh, yeah ... I didn't read that part. I would have been easier though if it had acted like a wildcard :-) Thanks! Valentin Dan, Software Developer Direct: +1 905 886 1833 ext.3047 Email: [EMAIL PROTECTED] Office: +40 356-710158 Masstech Group Inc. Fax:+40 256-220912 http://www.masstechgroup.com THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU. -Original Message- From: Ken Ferry [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2008 1:00 PM To: Valentin Dan Cc: cocoa-dev@lists.apple.com; Dan Tascau; Tim Rodgers Subject: Re: NSNotificationCenter removeObserver NOT working Hi Valentin, I think you're hoping that passing nil for the observer acts as a wildcard? It does not, check the docs. Observer to remove from the dispatch table. Specify an observer to remove only entries for this observer. Must not be nil, or message will have no effect. -Ken On Thu, Sep 4, 2008 at 2:51 AM, Valentin Dan [EMAIL PROTECTED] wrote: Hi, I'm trying to remove all notifications that have a certain object and I can't seem to get that to work. I'm doing something like this: [[NSNotificationCenter defaultCenter] removeObserver:nil name:nil object:myObject]; The notifications for this sender keep coming and that causes a problem. How can I fix that ? Thanks! ___ Valentin Dan, Software Developer Direct: +1 905 886 1833 ext.3047 Email: [EMAIL PROTECTED] Office: +40 356-710158 Masstech Group Inc. Fax:+40 256-220912 http://www.masstechgroup.com http://www.masstechgroup.com/ THIS MESSAGE IS INTENDED ONLY FOR THE ADDRESSEE. IT MAY CONTAIN PRIVILEGED OR CONFIDENTIAL INFORMATION.ANY UNAUTHORIZED DISCLOSURE IS STRICTLY PROHIBITED.IF YOU HAVE RECEIVED THIS MESSAGE IN ERROR, PLEASE NOTIFY US IMMEDIATELY SO THAT WE MAY CORRECT THE RECORDS. PLEASE THEN DELETE THE ORIGINAL MESSAGE. THANK YOU. ___ 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/kenferry%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]
Core Data Form
Hello, I have a problem with my app that is most likely very simple for someone with experience. I have a core data based application that I would like to be able to add objects to via a sheet that drops down when the user clicks the + button (or presses Command-N). On the sheet are two NSTextField and one NSPopUpButton, an add button and a cancel button. From my AppController class I can get the values as strings that are entered into the sheet here: - (IBAction)endAddHostSheet:(id)sender { NSString *hostString = [hostNameTextField stringValue]; if ([hostString length] == 0) { return; } NSLog(@the host name is %@, hostString); NSString *ipAddressString = [ipAddressTextField stringValue]; if ([ipAddressString length] == 0) { return; } NSLog(@the ip address is %@, ipAddressString); NSString *selectedGroupString = [groupsPopUpButton titleOfSelectedItem]; NSLog(@the selected Group is %@, selectedGroupString); // Do stuff to add to core data here... [NSApp endSheet:addHostSheet]; //Goodbye, sheet [addHostSheet orderOut:sender]; } But my question is, how can I add these strings to core data? My core data setup is very simple. I have three entities (one which I'm not yet using) named Host, Group, and ContactGroup. Host has attributes hostName, ipAddress, and a to-one relationship named group. Group has an attribute groupName, and a to-many relationship named hosts. I've defined classes for the Entities, like this: #import Cocoa/Cocoa.h @class ContactGroup; @class Group; @interface Host : NSManagedObject { } @property (readwrite, retain) ContactGroup *contactGroup; @property (readwrite, retain) Group *group; @property (readwrite, copy) NSString *hostName, *ipAddress, *CPU, *RAM, *hardDrive; +(id)addHostFromPanel:(NSString *)newHostPanel withName:(NSString *)newHostName andIpAddress:(NSString *)newIpAddress inGroup:(NSString *)newGroup; @end I've was trying to add the hosts with the addHostFromPanel method defined above (with a + instead of a -), and implemented like this: +(id)addHostFromPanel:(NSString *)newHostPanel withName:(NSString *)newHostName andIpAddress:(NSString *)newIpAddress inGroup:(NSString *)newGroup { // Debug stuff NSLog(@host name passed over is is %@, newHostName); NSLog(@ip address passed over is is %@, newIpAddress); NSLog(@the group passed over is %@, newGroup); // Here we go! Host *host = [NSEntityDescription insertNewObjectForEntityForName:@Host inManagedObjectContext:[self managedObjectContext]]; host.hostName = newHostName; host.ipAddress = newIpAddress; host.group = newGroup; return host; } But, when I try to call this method from my AppController to add the strings to core data, I get an error (as well as a compile warning) that Host can't find it's managedObjectContext. I'm very new to Cocoa (obviously), and right now I'm very confused. I'm sure I'm missing something very basic here, but I've been stuck on this for a couple of weeks now. Thanks in advance for any advice. 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 [EMAIL PROTECTED]
Launching preference panel of an application from another application
Hi I am a newbie into cocoa programming. Can anyone let me know how can we launch Preference panel of one cocoa application from another cocoa application. I am have written a cooca application in which Preference panel can be launched through by clicking on AppName - Preferences Also i have written one more application which is a per-user login Menulet process. This process will be launched upon user log-in and will insert an Status icon in the Status bar. From this i status bar item i need to launch the Preference panel of the earlier Application. Can anyone suggest how can i achieve this. Thanks in advance Arun ___ 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 [EMAIL PROTECTED]
Re: Finder Eject Button in OutlineView
Hi Corbin, Thanks you very much . This is the one I Was looking for . On Sep 2, 2008, at 8:41 AM, Corbin Dunn wrote: On Sep 1, 2008, at 4:25 PM, kiran Sanka wrote: I am trying to figure out how I might be able to do something like Finder does displaying disc Eject Image(When disc inserted) indicator as part of an outline item. I did by customizing NSTextField Cell as below - (void) drawWithFrame:(NSRect)inRect inView:(NSView *)inView { // First we split the cell in two NSRect textFrame, imageFrame; NSDivideRect (inRect, imageFrame, textFrame, 3.0f + [urlIcon size].width, NSMaxXEdge); if([self icon] != nil) { NSPoint imageLocation = NSMakePoint( NSMidX(imageFrame), NSMidY(imageFrame) ); imageLocation.x -= [urlIcon size].width/2.0f; imageLocation.y -= [urlIcon size].height/2.0f; // Draw the Disc Eject image if ([[NSGraphicsContext currentContext] isDrawingToScreen]) { if ([[self stringValue] length]) { [urlIcon drawAtPoint:imageLocation fromRect:NSMakeRect( 0, 0, [urlIcon size].width, [urlIcon size].height ) operation:NSCompositeSourceOver fraction:1.0f]; } } [super drawWithFrame:textFrame inView:inView]; } // Let our super do what it does best [super drawWithFrame:inRect inView:inView]; } But when mouse roll over to discEjectImage i would like set another image like finder EjectImage.But i dont know how to work out with mouseEntered and mouseMove in a particular cell of an outlineView I'd be grateful is someone could push me in the right direction. Sure, http://developer.apple.com/samplecode/PhotoSearch/index.html -corbin kiran Sanka ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
On 04.09.2008, at 21:35, I. Savant wrote: On Thu, Sep 4, 2008 at 3:26 PM, Quincey Morris [EMAIL PROTECTED] wrote: Option-Return? Well there's an 'option'. Have you tested this in a binding? I'm interested in hearing whether it actually works. Just tried it. Works like a charm. Glad to learn about this. Though the editing experience leaves a bit to be desired. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
On Thu, Sep 4, 2008 at 3:44 PM, Uli Kusterer [EMAIL PROTECTED] wrote: Just tried it. Works like a charm. Glad to learn about this. Though the editing experience leaves a bit to be desired. Hey, great! Glad as well, thanks, guys! -- I.S. ___ 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 [EMAIL PROTECTED]
Re: Disabled NSButton
On Sep 4, 2008, at 1:33 PM, Ronnie B wrote: Hi All! I am implementing a login panel. I would like to have 'Ok' button disabled as long as the password field is empty. Any advise? -controlTextDidChange: delegate method; in it, [en|dis]able the button according to the length of the password field text. ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
On Sep 4, 2008, at 1:35 PM, I. Savant wrote: On Thu, Sep 4, 2008 at 3:26 PM, Quincey Morris [EMAIL PROTECTED] wrote: Option-Return? Well there's an 'option'. Have you tested this in a binding? I'm interested in hearing whether it actually works. Yes, it also works in the single-line Label UI widgets, without having to change the linewrap/scroll setting on it. Among other places... ___ 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 [EMAIL PROTECTED]
Re: Launching preference panel of an application from another application
On Sep 4, 2008, at 10:59 AM, Arun wrote: Can anyone let me know how can we launch Preference panel of one cocoa application from another cocoa application. You'd have to use AppleScript or DO to do that, pick one. Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Re: Disabled NSButton
Thanks Randall. It worked. On Thu, Sep 4, 2008 at 3:42 PM, Randall Meadows [EMAIL PROTECTED] wrote: On Sep 4, 2008, at 1:33 PM, Ronnie B wrote: Hi All! I am implementing a login panel. I would like to have 'Ok' button disabled as long as the password field is empty. Any advise? -controlTextDidChange: delegate method; in it, [en|dis]able the button according to the length of the password field text. ___ 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 [EMAIL PROTECTED]
Re: line break in Interface Builder
That works. Thanks everybody! John ___ 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 [EMAIL PROTECTED]
Re: NSNotificationCenter removeObserver NOT working
On Thu, Sep 4, 2008 at 5:51 AM, Valentin Dan [EMAIL PROTECTED] wrote: I'm trying to remove all notifications that have a certain object and I can't seem to get that to work. I'm doing something like this: [[NSNotificationCenter defaultCenter] removeObserver:nil name:nil object:myObject]; The notifications for this sender keep coming and that causes a problem. How can I fix that ? A good general guideline for NSNotificationCenter methods: if you aren't passing 'self' as the observer parameter, you're probably doing something wrong. Management of observation should be done by the observers and not by anything else. There may be situations where this is not the case, but if there are then I have yet to encounter one in my years of working on OS X. 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 [EMAIL PROTECTED]
Re: Disabled NSButton
On Sep 4, 2008, at 12:33 PM, Ronnie B [EMAIL PROTECTED] wrote: I would like to have 'Ok' button disabled as long as the password field is empty. Add a -canLogIn method to the panel's controller that returns YES when the user has entered a password. Then bind your button's enabled state to your controller's canLogIn property. -- Chris ___ 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 [EMAIL PROTECTED]
NSTask Question
So I need to use NSTask and I am trying to run a small executable command-line app from inside my 'resources' directory in my app bundle. But what is the right path to access? The app I want to run is here: appname.app/Contents/Resources/app to run And the app I want to access from is at: appname.app/Contents/MacOs I have tried a bunch of variations and nothing is working I get: [1855:813] launch path not accessible Thoughts? -Jason ___ 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 [EMAIL PROTECTED]
Re: NSTask Question
On Sep 4, 2008, at 3:42 PM, J. Todd Slack wrote: So I need to use NSTask and I am trying to run a small executable command-line app from inside my 'resources' directory in my app bundle. But what is the right path to access? The right path is whatever this method returns: [[NSBundle mainBundle] pathForResource:@your-task-name-here ofType:@] Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Re: NSTask Question
Hi Nick, Thanks, that seems better, than trying to build it up myself. Thanks, -Jason On Sep 4, 2008, at 2:56 PM, Nick Zitzmann wrote: On Sep 4, 2008, at 3:42 PM, J. Todd Slack wrote: So I need to use NSTask and I am trying to run a small executable command-line app from inside my 'resources' directory in my app bundle. But what is the right path to access? The right path is whatever this method returns: [[NSBundle mainBundle] pathForResource:@your-task-name-here ofType:@] Nick Zitzmann http://www.chronosnet.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 [EMAIL PROTECTED]
Circular NSSlider: How to get the same behaviour as in Quartz Composer?
Hi! In Quartz Composer, published input ports of type index or number have a text field and a circular NSSlider in the viewer's parameter panel. This NSSlider behaves exactly like I would like mine to behave, but I can't figure out how to do that. What I'm getting: One full rotation clockwise gives the values from - minValue to -maxValue. What I'd like: One full rotation clockwise increments the value by a certain amount (in Quartz Composer this is something like 6 or 7). I probably could do something like keeping track of the count of the full rotations of the slider, multiply that by some value and add the result to the value I want to modify, but this seems clunky. Isn't there any other way? Thanks, Marco ___ 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 [EMAIL PROTECTED]
GDB Problems
Hey, On one of my projects any time I try to start the program with a debug point set, GDB crashes before anything happens. It prints out: run [Switching to process 2279 local thread 0x2d03] Running… 2008-09-04 16:32:28.470 MyApp[2279:813] 1.0 [Switching to process 2279 thread 0x5603] [Switching to process 2279 thread 0x5603] Program received signal: EXC_BAD_ACCESS. Cannot access memory at address 0x4 Cannot access memory at address 0x4 I then did a backtrace and get: *(gdb) **backtrace* #0 0xdeadbeef in ?? () Cannot access memory at address 0x4 What is extremely frustrating is that this has started to happen in all of my applications, even a brand new vanilla project. This project is the only one that it happens all of the time for though, usually building and rebuilding will a successful launch. After some Googling, it seems others have run into this problem but no one posted a fix. One person suggested it had to do with his installation of both Xcode2.5 and Xcode3.1, which I had both installed. I uninstalled both and then reinstalled Xcode3.1, but the problem persists. It looks like someone had a similar problem with a Java app that got resolved ( http://www.mailinglistarchive.com/[EMAIL PROTECTED]/msg06697.html), but mine isn't Java. Please help me! I can't continue to work until this is resolved and I have already spent a few days trying to figure it out. Thank You, Bridger Maxwell ___ 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 [EMAIL PROTECTED]
NSTableView Protocol Help!
So, I've written a practice application with NSTableView, and NSMutableArray. I have NSTableView connected to AppController as a dataSource, and I connected all outlets. I have ALREADY defined the protocols needed, but for some reason, this message keeps on appearing in the debugger: *** Illegal NSTableView data source (MyDocument: 0x167290). Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row: Here are the protocols that I have written: ___ - (void)tableView:(NSTableView *)anotherTableView setObjectValue:(id)anObject forTableColumn:(NSTableColumn *)anotherTableColumn row:(NSInteger)rowIndex { [mutableArray replaceObjectAtIndex:rowIndex withObject:anObject]; } - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { return [mutableArray objectAtIndex:rowIndex]; } - (NSInteger)numberOfRowsInTableView:aTableView { return [splitViewMutableArray count]; } ___ Thanks for any help!! ___ 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 [EMAIL PROTECTED]
Re: NSTableView Protocol Help!
9/4/08 5:10 PM, also sprach [EMAIL PROTECTED]: So, I've written a practice application with NSTableView, and NSMutableArray. I have NSTableView connected to AppController as a dataSource, and I connected all outlets. I have ALREADY defined the protocols needed, but for some reason, this message keeps on appearing in the debugger: *** Illegal NSTableView data source (MyDocument: 0x167290). Must implement numberOfRowsInTableView: and tableView:objectValueForTableColumn:row: As the error shows, the datasource for the tableview is set as a MyDocument instance, and not your AppController class. HTH, Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ 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 [EMAIL PROTECTED]
Re: GDB Problems
On Sep 4, 2008, at 5:49 PM, Bridger Maxwell wrote: On one of my projects any time I try to start the program with a debug point set, GDB crashes before anything happens. It prints out: run [Switching to process 2279 local thread 0x2d03] Running… 2008-09-04 16:32:28.470 MyApp[2279:813] 1.0 [Switching to process 2279 thread 0x5603] [Switching to process 2279 thread 0x5603] Program received signal: EXC_BAD_ACCESS. Cannot access memory at address 0x4 Cannot access memory at address 0x4 I then did a backtrace and get: *(gdb) **backtrace* #0 0xdeadbeef in ?? () Cannot access memory at address 0x4 What is extremely frustrating is that this has started to happen in all of my applications, even a brand new vanilla project. This project is the only one that it happens all of the time for though, usually building and rebuilding will a successful launch. I suspect you've recently installed a haxie, input manager, third- party kernel extension or other piece of software which modifies the behavior of nearly all applications on your system. It seems to be interfering with gdb. If you can figure out what it is, disable or uninstall it and reboot. Good luck, Ken ___ 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 [EMAIL PROTECTED]
string convertion: converting getter name to setter
from the selector of a given getter function, I need to get the selector of the equivalent setter function. For instance, from color I should get setColor. char* getterName = sel_getName(getterSelector); char * setterName = ... ? ... SEL setterSelector = sel_getUid(setterName); What would be the less costly way, performance wise, to convert the C string color to setColor? I have no experience in working with strings in objc, and was hoping someone would point me in the right direction before I start. ___ 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 [EMAIL PROTECTED]
Re: What Size My Window?
On 4 Sep 2008, at 15:49, Uli Kusterer wrote: On 04.09.2008, at 10:10, Gerriet M. Denkmann wrote: 6. Other? So: is there some commonly agreed upon right strategy? Are there some official guidelines for document window sizes? You can save the size of your window in some plist in your document using -stringWithSavedFrame and restore it using - setFrameFromString:. That would be per-document. The one issue this has is that the user would have to save the document each time to make this stick. So just moving a window dirties the document. It's a little hard to do this using an NSDocument, but a common approach is to use a resource or xattributes to attach the window positions to a file without touching the actual document. That way, diff and similar tools won't think it's changed, and if the position gets lost during internet transfer, that's not too bad, as it's not vital information. Although keeping size per document is not my current aim, the idea of using xattributes is a very neat one. I will definitely keep this in mind for the future. Thanks for this hint! Kind regards, Gerriet. ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Sep 4, 2008, at 5:40 PM, steph thirion wrote: from the selector of a given getter function, I need to get the selector of the equivalent setter function. For instance, from color I should get setColor. char* getterName = sel_getName(getterSelector); char * setterName = ... ? ... SEL setterSelector = sel_getUid(setterName); What would be the less costly way, performance wise, to convert the C string color to setColor? I have no experience in working with strings in objc, and was hoping someone would point me in the right direction before I start. Hi! Two functions that you may consider are: NSStringFromSelector() NSSelectorFromString() The first, per its name, will create an NSString out of a SEL variable, while the second will reverse the process. Thus, for a selector of balloonColor (for example) you could have: SEL getterSel = @selector(balloonColor); NSString *getterName = NSStringFromSelector(getterSel); NSString *setterName = [@set stringByAppendingString:getterName]; SEL setterSel = NSSelectorFromString(setterName); This is probably one of the easiest Cocoa ways to do what you want, at least using the steps that you have outlined. There may of course be an easier way to do it but without knowing the specifics of your situation it's harder to tell what might be more suited to your situation. Hope this helps! Cheers, Andrew smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 12:40 PM, steph thirion [EMAIL PROTECTED] wrote: from the selector of a given getter function, I need to get the selector of the equivalent setter function. For instance, from color I should get setColor. I assume you want to do more with the selector than just invoke it---otherwise you can just use KVC and save yourself some grief. There are a few cases you may encounter here: 1. There is no setter. 2. There is a setter and the class is KVC compliant for the key. 3. There is a setter and the class isn't KVC compliant for the key, but there is a setter defined as part of a property definition. 4. (3) but without the property definition. char* getterName = sel_getName(getterSelector); Instead of using C strings, you can use NSStrings and NSSelectorFromString() and NSStringFromSelector()---making string manipulation much easier. However, for case (3), you'll need to do some parsing of the property attribute list from property_getAttributes(). What would be the less costly way, performance wise, to convert the C string color to setColor? I have no experience in working with strings in objc, and was hoping someone would point me in the right direction before I start. If you're working in Cocoa (and I assume you are, since this is a cocoa-dev list), this is a good starting point: http://developer.apple.com/documentation/Cocoa/Conceptual/Strings/ Phil ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 1:27 PM, Andrew Merenbach [EMAIL PROTECTED] wrote: SEL getterSel = @selector(balloonColor); NSString *getterName = NSStringFromSelector(getterSel); NSString *setterName = [@set stringByAppendingString:getterName]; SEL setterSel = NSSelectorFromString(setterName); Selector's are case-sensitive, so you'll have to do... setterName = [@set stringByAppendingString:[getterName capitalizedString]]; Phil ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Sep 4, 2008, at 6:37 PM, Phil wrote: On Fri, Sep 5, 2008 at 1:27 PM, Andrew Merenbach [EMAIL PROTECTED] wrote: SEL getterSel = @selector(balloonColor); NSString *getterName = NSStringFromSelector(getterSel); NSString *setterName = [@set stringByAppendingString:getterName]; SEL setterSel = NSSelectorFromString(setterName); Selector's are case-sensitive, so you'll have to do... setterName = [@set stringByAppendingString:[getterName capitalizedString]]; Phil Hi, Phil, I did indeed overlook this aspect. Thanks for pointing that out! Cheers, Andrew smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: Changing the model behind contoller's back?
On 04/09/2008, at 9:52 PM, Oleg Krupnov wrote: The question is: am I allowed to alter the model directly, or should I always use the controller? You can change the model directly, but you must use KVC-compliant methods to do so, unless you fire -willChangeValueForKey and - didChangeValueForKey in your custom method. Normally you would use indexed accessor methods for collection types, e.g.: - (unsigned int)countOfFoo; - (id)objectInFooAtIndex:(unsigned int)index; - (void)insertObject:(id)anObject inFooAtIndex:(unsigned int)index; - (void)removeObjectFromFooAtIndex:(unsigned int)index; - (void)replaceObjectInFooAtIndex:(unsigned int)index withObject: (id)anObject; Have a look here: http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#/ /apple_ref/doc/uid/20002174 -- Rob Keniger ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Sep 4, 2008, at 6:37 PM, Phil wrote: On Fri, Sep 5, 2008 at 1:27 PM, Andrew Merenbach [EMAIL PROTECTED] wrote: SEL getterSel = @selector(balloonColor); NSString *getterName = NSStringFromSelector(getterSel); NSString *setterName = [@set stringByAppendingString:getterName]; SEL setterSel = NSSelectorFromString(setterName); Selector's are case-sensitive, so you'll have to do... setterName = [@set stringByAppendingString:[getterName capitalizedString]]; Phil From memory I think that does not work: capitalizedString also decapitalizes all but the first character, so capitalizedString will become setCapitalizedstring instead of setCapitalizedString. ___ 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/bagelturf%40mac.com This email sent to [EMAIL PROTECTED] Steve Weller [EMAIL PROTECTED] Technical Writing, Editing, Developer Guides, and a little Cocoa ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 1:53 PM, Steve Weller [EMAIL PROTECTED] wrote: From memory I think that does not work: capitalizedString also decapitalizes all but the first character, so capitalizedString will become setCapitalizedstring instead of setCapitalizedString. Gah, you're right! I guess the only way to do it then is with an NSMutableString: NSMutableString *getterName = [NSStringFromSelector(...) mutableCopy] [getterName replaceCharactersInRange:NSMakeRange(0, 1) withString:[[getterName substringToIndex:1] uppercaseString]]; Maybe it is easier with C strings: const char *getterName = sel_getName(...) char *getterName_m = strdup(getterName); getterName_m[0] = toupper(getterName_m[0]); // and clean up... Phil ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Sep 5, 2008, at 3:34 AM, Phil wrote: I assume you want to do more with the selector than just invoke it---otherwise you can just use KVC and save yourself some grief. Actually, that's all I want! I'm working on a class that will manage transitions of properties. It's for a game on a slower device, so I need the less costly solution. I was trying to go with performSelector, but just a while ago I was stunned to find out there's no way to pass along an argument that is a basic type. Same with NSInvocation, AFAIK you can only pass objects. And I'd rather avoid having NSNumber instances instead of simply int variables just because of that. Using an instance where I simply need an int or a float seems a waste of memory and performance, correct me if I'm wrong. Then there's KVC. Which I haven't been able to pull out because of some int / id problems in arithmetics that I couldn't understand yet. But the concept of KVC seems like it could be costly, at least more than pointing directly to the right door, like performSelector or NSInvocation does. I'm a bit confused, I thought I was getting into something simple to resolve and it's growing into a big monster. Help would be deeply appreciated. (btw thanks all for the input on the string conversions.. I might look into it once I get past this) ___ 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 [EMAIL PROTECTED]
Animated images in a NSTableView
I am having problems with animated images in a NSTableView (specifically an animated GIF). After some experimentation, I have determined that the problem seems to be that the view doesn't update itself after the next frame in the animation loads. I determined this after I noticed that the images did change any time I resized the table's window. As a workaround, I created a NSTimer that fires off a - setNeedsDisplayInRect to the table view every .05 seconds. This works, but has a couple of problems: 1. It seems like invalidating the entire table column might affect performance if I get a lot of rows. 2. It doesn't work with Cocoa bindings. From what I've been able to figure out, every time I call setNeedsDisplayInRect, the binding calls the model's image getter method, and this seems to reset the animation to the first frame. Does anybody have suggestions on a better solution? -- Dave Carrigan [EMAIL PROTECTED] Seattle, WA, USA PGP.sig Description: This is a digitally signed message part ___ 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 [EMAIL PROTECTED]
[MEET] Minnesota CocoaHeads 9/11/08
I wanted to announce the next Minnesota CocoaHeads meeting is next Thursday (9/11) from 6:00-8:00pm. We meet at the offices of Synergy Information Services in Bloomington. Troy Gaul will giving a presentation entitled Lightroom Exposed. Troy is Adobe Photoshop Lightroom’s lead and will talk about its evolution and unconventional architecture (large parts are written in Lua). This should be a very interesting discussion! We'll also be giving out 2 copies of the newly released Excode 3: Unleased. Come join us and register to win. If you'd like some more information or directions, please stop by one of our sites: http://www.cocoaheadsmn.org/ http://www.cocoaheads.org/us/MinneapolisMN/index.html Thanks, Bob McCune http://www.bobmccune.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 [EMAIL PROTECTED]
Accessing SDL Frameworks Bundled with Leopard...
Does anybody know any official or proper way to link to the SDL framework that is bundled in the root library in Leopard? /Library/Frameworks/SDL.framework is surprisingly, there! ___ 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 [EMAIL PROTECTED]
Re: Accessing SDL Frameworks Bundled with Leopard...
On Fri, Sep 5, 2008 at 4:04 PM, John Joyce [EMAIL PROTECTED] wrote: Does anybody know any official or proper way to link to the SDL framework that is bundled in the root library in Leopard? /Library/Frameworks/SDL.framework is surprisingly, there! Not on my system. /Library/Frameworks is typically for frameworks shared by installed applications on the system, the frameworks that come bundles with the system are in /System/Library/Frameworks. Something else has probably installed SDL.framework. I would suggest getting your own copy of the SDL framework to use. Phil ___ 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 [EMAIL PROTECTED]
Re: Accessing SDL Frameworks Bundled with Leopard...
On Sep 5, 2008, at 00:04 , John Joyce wrote: Does anybody know any official or proper way to link to the SDL framework that is bundled in the root library in Leopard? /Library/Frameworks/SDL.framework is surprisingly, there! I don't have any such directory on my installation of Leopard. Another application probably installed this there (/Library/Frameworks is for 3rd-party, shared frameworks usually). You should find the source and use that because if your application doesn't come with this framework, chances are it will fail to load on somebody else's computer (like mine). But, once you have the framework, you just drag it into shared frameworks in XCode or add it as a -framework flag to gcc. Jason smime.p7s Description: S/MIME cryptographic signature ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Fri, Sep 5, 2008 at 2:51 PM, steph thirion [EMAIL PROTECTED] wrote: I was trying to go with performSelector, but just a while ago I was stunned to find out there's no way to pass along an argument that is a basic type. Same with NSInvocation, AFAIK you can only pass objects. And I'd rather avoid having NSNumber instances instead of simply int variables just because of that. Using an instance where I simply need an int or a float seems a waste of memory and performance, correct me if I'm wrong. You can use +instanceMethodForSelector: to get a function that you can use to call the method with primitive arguments---see the overview section of the NSObject class reference. Then there's KVC. Which I haven't been able to pull out because of some int / id problems in arithmetics that I couldn't understand yet. But the concept of KVC seems like it could be costly, at least more than pointing directly to the right door, like performSelector or NSInvocation does. However, finding the correct door is probably just as costly (or potentially more than) KVC. I'd suggest avoiding developing your own solution unless you know there's a problem with using what's provided by the framework. If you can tell us a bit more about what you're trying to accomplish, we might be able to suggest some better approaches. Phil ___ 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 [EMAIL PROTECTED]
Re: Why do all these methods of measuring string metrics with font attribute fail?
On Sep 3, 2008, at 9:38 AM, Douglas Davidson wrote: On Sep 3, 2008, at 6:01 AM, an0 wrote: So, can anyone tell me why all these fell through so badly, and what is the true straightforward way to do this if any? The true straightforward way to do this is with -sizeToFit. -sizeWithAttributes: will give you the size of the string, but what you appear to want here is to size the textfield, which is not the same thing. Coming into this discussion a little late . . . A little experimenting suggests to me that -sizeWithAttributes: appears to not really give you the *real* size of the string (by which I think you might mean the measured size of the glyphs indicated by that string). The size appears to contain an advance or right-side bearing space after the final character.So the size looks like it's some number of units bigger than the strict bounding box of the string of glyphs. I would appreciate some ideas on how to find a *real* bounding box for a string. Cheers, . . . . . . . .Henry ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
--- On Thu, 9/4/08, steph thirion [EMAIL PROTECTED] wrote: I'm working on a class that will manage transitions of properties. It's for a game on a slower device, so I need the less costly solution. I can understand your performance constraints, but have you actually profiled your game and found that the speed of KVC is a significant problem? This screams premature optimization to me. I mean, I suppose it's possible, but this seems relatively lightweight compared to what usually makes up a game. Cheers, Chuck ___ 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 [EMAIL PROTECTED]
Re: string convertion: converting getter name to setter
On Thu, Sep 4, 2008 at 10:51 PM, steph thirion [EMAIL PROTECTED] wrote: Same with NSInvocation, AFAIK you can only pass objects. Where'd you get that idea? NSInvocation's -setArgument:atIndex: method takes a void* for its first argument, and describes it as an untyped buffer. If only objects could be passed, the first argument would be declared as id*. Also, its description says This method copies the contents of *buffer* as the argument at *index*. The number of bytes copied is determined by the argument size. There would be no need to determine their size, since objects are pointers and pointers are all the same size. The only documented limitation with respect to argument types is that it can't handle variadic argument lists, or union types. And I'd rather avoid having NSNumber instances instead of simply int variables just because of that. Using an instance where I simply need an int or a float seems a waste of memory and performance, correct me if I'm wrong. Frankly, this smells a *lot* like premature optimization. Do you have any evidence that the simple solution doesn't perform acceptably? That is, have you written your code the easy way first, and profiled it with Shark? sherm-- -- Cocoa programming in Perl: http://camelbones.sourceforge.net ___ 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 [EMAIL PROTECTED]
Re: NSPanel: resigning key focus?
Peter. Yes, bracketing the calls removes the flicker. But as far as the correct solution goes: There might not be any other window which I should make key. In that case the panel should simply resign the key focus and let application handle the events. It seems this will be the solution for now. Thank you. - Vijay On Fri, Sep 5, 2008 at 8:48 AM, Peter N Lewis [EMAIL PROTECTED]wrote: The correct solution is probably to figure out which should be the key window and make that key, however: If I do: [window orderOut: nil]; [window orderFront: nil]; // Not asking it to be key This results in the behavior I am trying to achieve. But this workaround will not work as there is a flicker (ordering out and ordering in). You could try bracketing that in NSDisableScreenUpdates(); [window orderOut: nil]; [window orderFront: nil]; // Not asking it to be key NSEnableScreenUpdates(); Enjoy, Peter. -- Keyboard Maestro 3 Now Available! Now With Status Menu triggers! Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac http://www.stairways.com/ http://download.stairways.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/vijay.malhan%40gmail.com This email sent to [EMAIL PROTECTED] ___ 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 [EMAIL PROTECTED]