Re: Bindings & Reverting Properties
Quincey Morris (quinceymor...@earthlink.net) on 2009-08-21 12:56 AM said: >since we're comparing comparing BOOLs, I'll contribute my preferred >version: > >- (void)setHappy: (BOOL)newHappy >{ > if (!happy != !newHappy) // Another way of safely comparing BOOLs I prefer: if (!!happy != !!newHappy) since the !! reads as 'nop' and thus more clear (IHMO). or if ((bool)happy != (bool)newHappy) (I hope Obj-C eventually gets rid of or fixes BOOL!) Sean ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings & Reverting Properties
> Someone has to say it: Why?! :-) > > I can't imagine any possible reason why any design should make it possible > for prefs saving to fail. Just because I can't imagine it doesn't make it > impossible, but it sounds very, very wrong. Well it seems my attempt to over-simplify the situation has raised more questions than answers. I should've expected that. =) One of the special features of the preferences controller is that it requires an AuthorizationRef to save the preferences. If the authorization times-out, then I ask the user to re-authorize. If the user clicks 'Cancel' in the authorization window, then the preferences will fail to save because the authorization isn't valid. No amount of checking can ensure that the authorization will be valid at precisely the instant that I actually attempt to write the preferences file to a privileged location; therefore, I need to be prepared to handle the error. > With respect, your entire approach is suspect. You might get a better > answer if you explain your overall goal and why you feel the preferences > system needs to be modified in this way to accomplish this goal. Whenever something in the UI changes, MyPrefsController is sent a -setValue: forKey: message. It overrides -setValue: forKey: to look something like -setHappy: in my original email: - (void)setValue: (id)newValue forKey: (NSString *)key { [self willChangeValueForKey: key]; // Need to manually trigger the notifications because we're overriding setValue: forKey: [newEntries setObject: newValue forKey: key]; // Set the property in our internal dictionary... [self didChangeValueForKey: key]; // Need to manually trigger the notifications because we're overriding setValue: forKey: if (![self save]) [self revert]; // The changes made here aren't reflected in the UI despite the correct KVO notifications being sent. } Let's assume -setValue: forKey: is being called because the user checked a checkbox in the UI (the checkbox went from being unchecked to checked), and let's also assume that saving fails because the user clicked 'Cancel' in the authorization window. These conditions lead to MyPrefsController -revert'ing, which should lead to the checkbox in the UI becoming unchecked again. The correct KVO notifications are sent in -revert, but they still don't cause the checkbox to become unchecked. If I schedule -revert to be called on the next iteration of the run loop, it works. But because -revert is called from the -setValue: forKey: that resulted from the checkbox becoming checked, the UI ignores any changes to the property that would otherwise trigger the UI to reflect the model property. And this is what I was trying to show with -setHappy:. Here's a better version of -setHappy: that shows my problem: - (void)setHappy: (BOOL)newHappy { happy = newHappy; [self willChangeValueForKey: @"happy"]; happy = NO; [self didChangeValueForKey: @"happy"]; } Imagine a checkbox is bound to the happy property. With a setter such as the one above, I would expect that as soon as you try to check the checkbox, it becomes unchecked. But that's not what happens - the checkbox works like any other checkbox. Does all that make sense? Thanks, David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings & Reverting Properties
> What led you to believe you needed to call the setter recursively? All you > need is: The only reason I did that was to show that the correct KVO notifications would be invoked by reverting the happy property from within the setter. It was a gross oversimplification, and I'm sorry. :) I realize that KVO notifications are sent automatically, and implicitly surround the -setHappy: setter. But to illustrate my point, I used the setter from within the setter to show that even with two more (implicit) -willChange/-didChange notifications, the UI does not reflect the model property if the model property is 'reverted' from within the setter. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting multi line Text to Radio button
On Friday, August 21, 2009, at 12:17PM, "Jerry Krinock" wrote: > >On 2009 Aug 21, at 06:39, Vijay Kanse wrote: > >> I want my radio buttons to have multi line text > >I've found this to be one of those things that "just doesn't work". >Set the title to an empty string, and display the title in an >adjoining text field ("Multi-line Label" from the Library) instead. You can enter a multi-line title in IB by typing Option-Return instead of Return, but it won't look like your screenshot because the circle icon is centered vertically in the cell. Note that if you use the adjacent text field, it will work slightly differently than a normal radio button, because normally you can click anywhere on the title to select a radio button. Of course, you can make it work like that with a little more code. Just thought I'd point it out in case it matters to you. >I get the feeling that someone in Apple's Human Interface Police >doesn't like multi-line radio button titles. Yeah, that sounds about right. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings & Reverting Properties
On Aug 22, 2009, at 00:14, Dave Keck wrote: What led you to believe you needed to call the setter recursively? All you need is: The only reason I did that was to show that the correct KVO notifications would be invoked by reverting the happy property from within the setter. It was a gross oversimplification, and I'm sorry. :) I realize that KVO notifications are sent automatically, and implicitly surround the -setHappy: setter. But to illustrate my point, I used the setter from within the setter to show that even with two more (implicit) -willChange/-didChange notifications, the UI does not reflect the model property if the model property is 'reverted' from within the setter. I think you missed my point. Well, points. First, within the setter, willChange/didChange have no effect, whether invoked explicitly or implicitly. (Actually, they may have an effect, but not the correct effect. Attempting to nest willChange/didChange is a Bad Idea because KVO notifications aren't nestable.) Second, there's no need. The KVO mechanism in no way depends on the value of the property, on exit from the setter, being the value passed into the setter. If you change then revert the underlying value (the instance variable) in the setter, the reverted value is the one that will be contained in the KVO notification as the "new" value. So you don't need to trigger any *additional* KVO notifications, because the one you get for free is enough. You gave this example: - (void)setHappy: (BOOL)newHappy { happy = newHappy; [self willChangeValueForKey: @"happy"]; happy = NO; [self didChangeValueForKey: @"happy"]; } The immediate problem here is the presence of willChange/didChange. If you change it to: - (void)setHappy: (BOOL)newHappy { happy = NO; } and a checkbox bound to it doesn't stay unchecked, then the real problem is elsewhere. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings & Reverting Properties
> not the correct effect. Attempting to nest willChange/didChange is a Bad > Idea because KVO notifications aren't nestable.) Is that documented? I would have thought that a nested willChange/didChange pair would have simply been ignored. > The immediate problem here is the presence of willChange/didChange. If you > change it to: > >> - (void)setHappy: (BOOL)newHappy >> { >> happy = NO; >> } > > and a checkbox bound to it doesn't stay unchecked, then the real problem is > elsewhere. Aye aye. Here's a simple project that uses that setter: http://themha.com/happy.zip When clicking the checkbox in the window, it stays checked. Regardless of what you do to the happy ivar within the setter, the checkbox assumes the intuitive value that results from the click, not whatever happy is actually set to. ... and that's my problem. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Setting multi line Text to Radio button
Some extra newlines preceeding your title should make it _look_ like your screenshot (for odd numbers of lines in the lable, anyway), but it still wont work quite the same, as there will be a clickable area above your lable. (if that makes sense). I dont know how that'll affect the spacing between the other buttons in the set tho ... paulm On 22/08/2009, at 7:38 PM, Andy Lee wrote: On Friday, August 21, 2009, at 12:17PM, "Jerry Krinock" wrote: On 2009 Aug 21, at 06:39, Vijay Kanse wrote: I want my radio buttons to have multi line text I've found this to be one of those things that "just doesn't work". Set the title to an empty string, and display the title in an adjoining text field ("Multi-line Label" from the Library) instead. You can enter a multi-line title in IB by typing Option-Return instead of Return, but it won't look like your screenshot because the circle icon is centered vertically in the cell. Note that if you use the adjacent text field, it will work slightly differently than a normal radio button, because normally you can click anywhere on the title to select a radio button. Of course, you can make it work like that with a little more code. Just thought I'd point it out in case it matters to you. I get the feeling that someone in Apple's Human Interface Police doesn't like multi-line radio button titles. Yeah, that sounds about right. --Andy ___ 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/list%40no-tek.com This email sent to l...@no-tek.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Syntax Coloring?
Hello, I'm writing a code editor and so far, i've been using Flex for regex-matching the whole document every time the text is changed and coloring appropriately... I got this idea from some CocoaBuilders or CocoaDev forum/mailing list awhile ago, but it's terribly inefficient and slow, especially with large documents. Just wondering if you guys have any suggestions in the direction I should go in... I just found NSPredicate, but I'm not sure if I should use it... Anyways, any suggestions are greatly appreciated, Keita ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Syntax Coloring?
Le 22 août 2009 à 14:33, Keitaroh Kobayashi a écrit : Hello, I'm writing a code editor and so far, i've been using Flex for regex-matching the whole document every time the text is changed and coloring appropriately... I got this idea from some CocoaBuilders or CocoaDev forum/mailing list awhile ago, but it's terribly inefficient and slow, especially with large documents. Just wondering if you guys have any suggestions in the direction I should go in... I just found NSPredicate, but I'm not sure if I should use it... Anyways, any suggestions are greatly appreciated, Keita I think the now abandoned smultron editor do that. Have a look at its sources: http://smultron.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 arch...@mail-archive.com
Re: Best Way to Simulate Keyboard
Hey, That works well, until I add modifiers. To do my modifiers i put the modifier keys down before the character part, but this doesn't seem to work when the command key is down or something :/ Is there any way to supply modifiers into a single CGEvent? Cheers, Joe Turner On Aug 21, 2009, at 5:49 PM, Eric Schlegel wrote: On Aug 21, 2009, at 2:55 PM, Joe Turner wrote: Hey, So, until now, I've been using CGEvents for simulating a keyboard. This posed a problem when I figured out CGKeyCodes must be translated based on localization/keyboard layout. And now it poses an ever bigger problem because of 'kchr' keyboards, which it seems, all API's that can access them have been deprecated. Could you use CGEventKeyboardSetUnicodeString to just supply the input text directly, rather than translating to a CGKeyCode? -eric ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Displaying svg image with WebKit - scaling issues
Hi, I would like to display a simple svg image in my app using webkit. Unfortunately I also need to be able to scale the image to the size of the view. The webview class has makeTextLarger and makeTextSmaller which works, but limits the scaling to about 10 'steps'. Apparently you can do scaling with a CSS transform, but I have no idea how to do this. Does anyone have an example? thanks! 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 arch...@mail-archive.com
Re: Displaying svg image with WebKit - scaling issues
II saw an NSSVGImageRep in webcore - I would have thought that you could use that with NSImage and do the normal scaling there. I haven't tried it, and could make use of it myself if it works, so would be interested if anyone else has had experience using it. Gideon I would like to display a simple svg image in my app using webkit. Unfortunately I also need to be able to scale the image to the size of the view. The webview class has makeTextLarger and makeTextSmaller which works, but limits the scaling to about 10 'steps'. Apparently you can do scaling with a CSS transform, but I have no idea how to do this. Does anyone have an example? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Table view with multiple columns
Thanks, NSDictionary is my friend. Max Il giorno 22/ago/09, alle ore 07:39, Andrew Farmer ha scritto: On 21 Aug 2009, at 03:53, Massimiliano Gargani wrote: I have a mutable array with inside something like "luke","l...@luke.com ","mark","m...@mark.com", .. ... - (id) tableView: (NSTableView*) tableView objectValueForTableColumn: (NSTableColumn *) tableColumn row: (int) row { id record, result; record = [namesList objectAtIndex:row]; result = [record objectForKey:[tableColumn identifier]]; return result; } when I run the app I get TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION Well... yes. NSString doesn't have an objectForKey method, so it throws an exception. I'd recommend restructuring your data store as an array of dictionaries, or an array of arrays - anything, really, besides an interleaved array. If you're dead-set on storing things that way, though, you'll need to handle that properly in your objectValueForTableColumn method. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Displaying svg image with WebKit - scaling issues
Le 22 août 2009 à 16:27, Peter Zegelin a écrit : Hi, I would like to display a simple svg image in my app using webkit. Unfortunately I also need to be able to scale the image to the size of the view. The webview class has makeTextLarger and makeTextSmaller which works, but limits the scaling to about 10 'steps'. Apparently you can do scaling with a CSS transform, but I have no idea how to do this. Does anyone have an example? thanks! You can display it in a simple HTML page with a single image whose width is 100% SVG Image ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Best Way to Simulate Keyboard
On Aug 22, 2009, at 10:24 AM, Joe Turner wrote: That works well, until I add modifiers. To do my modifiers i put the modifier keys down before the character part, but this doesn't seem to work when the command key is down or something :/ Is there any way to supply modifiers into a single CGEvent? There's an example somewhere in the docs. Basically, you send, for example, a command-key down event, then the character key down event, then the character key up event, then the command-key up event. Tedious but straightforward. -- Bill Cheeseman b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Best Way to Simulate Keyboard
But then I must have the CGKeyCode for the character i would like to post, which is what I'm trying to get away from. When I do "CGEventSetFlags" on an event I've set a unicode string for, it doesn't work. Joe On Aug 22, 2009, at 11:46 AM, Bill Cheeseman wrote: On Aug 22, 2009, at 10:24 AM, Joe Turner wrote: That works well, until I add modifiers. To do my modifiers i put the modifier keys down before the character part, but this doesn't seem to work when the command key is down or something :/ Is there any way to supply modifiers into a single CGEvent? There's an example somewhere in the docs. Basically, you send, for example, a command-key down event, then the character key down event, then the character key up event, then the command-key up event. Tedious but straightforward. -- Bill Cheeseman b...@cheeseman.name ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
checkbox question
I wonder if someone can just point me in the correct direction. I am at the stage of not really knowing if the error is simply a missed connection, etc or a fundamental misunderstanding. I have a checkbox, which I wish to bind to an iVar in my model ( which is a windowController). What I am doing right now is creating an NSButton object in the model, and "assuming" .probably incorrectly, that by having the correct getters/setters available ( eg state/setState etc) I can bind the view's checkbox title, alternateTitle, status to the NSButton in the model. That is not working for me. ("Cannot create BOOL from object of class NSButton"). Is this my error, or do I need to create an iVar for each of the button elements I wish to bind to? I have checked the archives, but could not find exactly what I was looking forbut that might be my error in not using the correct key words. ( I will gladly show code, but I suspect the issue is beyond that). 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 arch...@mail-archive.com
Re: checkbox question
On Aug 22, 2009, at 16:16, Michael de Haan wrote: I wonder if someone can just point me in the correct direction. I am at the stage of not really knowing if the error is simply a missed connection, etc or a fundamental misunderstanding. Fundamental misunderstanding. :) I have a checkbox, which I wish to bind to an iVar in my model ( which is a windowController). No, you don't bind anything to an ivar, you bind things to properties. What I am doing right now is creating an NSButton object in the model, and "assuming" .probably incorrectly, that by having the correct getters/setters available ( eg state/setState etc) I can bind the view's checkbox title, alternateTitle, status to the NSButton in the model. That is not working for me. ("Cannot create BOOL from object of class NSButton"). Your NSButton object isn't *in* the model. It may be an outlet of the window controller, but that's a feature of the controller role, not of the data model role, of the window controller. Bind *from* your view (the checkbox) *to* properties of your data model. There's no "status" binding for a NSButton, so I assume you mean "value". You already have the "state" property to use for that. Specifically, in IB, you'll bind the NSButton's "value" binding to the "state" property of File's Owner (your window controller). Is this my error, or do I need to create an iVar for each of the button elements I wish to bind to? If you want to bind the "title" and "alternateTitle" bindings too (not that I'd recommend it -- the whole point of a checkbox is that the on/ off state is shown by the checkmark, not by the text), then you must create properties of your window controller to bind to. These will be NSString* properties. One way to do it is to create ivars backing each of the string properties and using @synthesize to create the accessors. If the title or alternate title varies over time, make sure you use the setter accessors to update the strings, so that any change gets propagated correctly to the user interface. Another way to do it is simply to write getters for each property that returns a suitable string, without using an ivar. If the string never varies, then that's the easiest way. However, if the string varies over time, you have to take additional steps to make sure that any change gets propagated to the user interface. For example, if the string depends on another property, you can use +keyPathsForValuesAffecting (in Leopard) to register the dependency. This issue, of ensuring correct propagation of your properties, is called "KVO-compliance", which you may have already come across. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings & Reverting Properties
On Aug 22, 2009, at 01:21, Dave Keck wrote: Aye aye. Here's a simple project that uses that setter: http://themha.com/happy.zip When clicking the checkbox in the window, it stays checked. Regardless of what you do to the happy ivar within the setter, the checkbox assumes the intuitive value that results from the click, not whatever happy is actually set to. ... and that's my problem. You're right, it doesn't work, but the problem isn't with the setter. I wish I could tell you what the problem is, but I don't know. It's likely something forehead-slappingly trivial, but I couldn't spot it. One thing that's "wrong" with your sample project, from my point of view, is that I don't believe in putting controllers in NIB files. You'd be better off moving the window to a separate NIB file and making your controller be a subclass of NSWindowController (and be File's Owner). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Displaying svg image with WebKit - scaling issues
Too Easy! Works perfectly in the MiniBrowser demo project. Many thanks! Peter On 23/08/2009, at 1:15 AM, Jean-Daniel Dupas wrote: Le 22 août 2009 à 16:27, Peter Zegelin a écrit : Hi, I would like to display a simple svg image in my app using webkit. Unfortunately I also need to be able to scale the image to the size of the view. The webview class has makeTextLarger and makeTextSmaller which works, but limits the scaling to about 10 'steps'. Apparently you can do scaling with a CSS transform, but I have no idea how to do this. Does anyone have an example? thanks! You can display it in a simple HTML page with a single image whose width is 100% SVG Image ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: checkbox question
On Aug 22, 2009, at 5:47 PM, Quincey Morris wrote: On Aug 22, 2009, at 16:16, Michael de Haan wrote: ..or a fundamental misunderstanding. Fundamental misunderstanding. :) That figures! I have a checkbox, which I wish to bind to an iVar in my model ( which is a windowController). No, you don't bind anything to an ivar, you bind things to properties. My lack of correct syntax...but your point is well taken. What I am doing right now is creating an NSButton object in the model, and "assuming" .probably incorrectly, that by having the correct getters/setters available ( eg state/setState etc) I can bind the view's checkbox title, alternateTitle, status to the NSButton in the model. That is not working for me. ("Cannot create BOOL from object of class NSButton"). Your NSButton object isn't *in* the model. It may be an outlet of the window controller, Correct but that's a feature of the controller role, not of the data model role, of the window controller. Bind *from* your view (the checkbox) *to* properties of your data model. OK...that certainly clarifies one thingso, one **cannot** bind to an object, but to that object's properties? (Hence the error when I tried that). Specifically, in IB, you'll bind the NSButton's "value" binding to the "state" property of File's Owner (your window controller). Is this my error, or do I need to create an iVar for each of the button elements I wish to bind to? If you want to bind the "title" and "alternateTitle" bindings too (not that I'd recommend it -- the whole point of a checkbox is that the on/off state is shown by the checkmark, not by the text), then you must create properties of your window controller to bind to. These will be NSString* properties. Perhaps I am not using the checkbox correctly, but I wish the label to illustrate that checked represents one type of unit ( eg pounds) and unchecked another ( eg kilograms). ( But, mainly I am trying to use my "Hillegass" knowledge as I work my way through his book. Just reading without trying to use it is pretty pointless to me and gives one a false sense of understanding...just IMHO. Plus making little apps that I use at work gives a sense of fulfillment.) This issue, of ensuring correct propagation of your properties, is called "KVO-compliance", which you may have already come across. Quincey, I **hope** my level of question did not imply that I was "KVO- ignorant" :-) Thanks ...will try what you say. Michael. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTextField too slow to update
Hi, I have a large list of files that are being copied in my app, and after each file I need it to update the NSTextField so that it reads something like this: Processing file X of X The problem is that the text field is way too slow in updating its value. So slow infact that nothing appears on the text field until all the files have been copied. Any faster way to do this? 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 arch...@mail-archive.com
Re: NSTextField too slow to update
On Aug 22, 2009, at 6:41 PM, PCWiz wrote: Any faster way to do this? Isn't this kind of the same question as your NSProgressIndicator query? --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: checkbox question
On Aug 22, 2009, at 18:11, Michael de Haan wrote: OK...that certainly clarifies one thingso, one **cannot** bind to an object, but to that object's properties? (Hence the error when I tried that). The error occurred because you bound a binding that requires a numeric value to something that produced a non-numeric value. If in IB you bind to an object and leave the "model key path" (i.e. the property) blank, it defaults to "self", which is a property of NSObject that returns the object itself. So you can bind to an object, by implicitly or explicitly using its "self" property. Perhaps I am not using the checkbox correctly, but I wish the label to illustrate that checked represents one type of unit ( eg pounds) and unchecked another ( eg kilograms). I'd suggest you label the checkbox something like "Use metric system for weights". In addition, you might want to go the trouble of adding a text label that says "lb" or "kg" after each measurement shown in your window. If you did that, you could add a "measurementUnits" property to your window controller: + (NSSet*) keyPathsForValuesAffectingMeasurementUnits { return [NSSet setWithObject: @"state"]; } - (NSString*) measurementUnits { return state ? @"kg" : "lb"; } and then bind each of the text labels to that property. Then when you click the checkbox, all the text labels will change automatically. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTextField too slow to update
On Aug 22, 2009, at 6:41 PM, PCWiz wrote: I have a large list of files that are being copied in my app, and after each file I need it to update the NSTextField so that it reads something like this: Processing file X of X The problem is that the text field is way too slow in updating its value. So slow infact that nothing appears on the text field until all the files have been copied. Any faster way to do this? As Kyle has already mentioned, you're asking the same question as in your NSProgressIndicator thread. Have you thought of changing your code so that your file processing is done in a worker thread? Then you could call - performSelectorOnMainThread:withObject:waitUntilDone: just before processing each file. If you set wait=NO then the UI can update itself without having to jump through hoops and the file processing can run without having to wait for the update to occur. steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTextField too slow to update
On Aug 22, 2009, at 18:41, PCWiz wrote: I have a large list of files that are being copied in my app, and after each file I need it to update the NSTextField so that it reads something like this: Processing file X of X The problem is that the text field is way too slow in updating its value. So slow infact that nothing appears on the text field until all the files have been copied. Updating text fields isn't that slow. Most likely the reason it isn't updating is something like: -- you're updating the status field from a thread other than the main thread -- the status field is bound to a property that isn't being updated KVO-compliantly -- you've stalled event processing in the main thread so no updates are getting processed ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Handling international text without text views
I've got an OpenGL application that implements its own widgets for text entry and display. The application is a Cocoa application. When in windowed mode, it uses a subclass of NSView for its GL context. In full-screen mode, it captures the display with CGL. I need to support international input, but it doesn't need to be inline. Using the bottom-line input bar is fine. When the application was Carbon, as I recall, I would setup a new TSM document, and that would automatically give me the bottom-line text input bar and I would process the input with my Carbon event handlers. I've been doing some searching on how to accomplish the same thing on Cocoa (enable the bottom-line text entry window and getting events containing the Unicode text), but haven't been able to find anything yet. It appears I might have to do something with NSInputManager, but I haven't really seen how I can accomplish what I want. I realize it's a complex subject, but can someone give me a couple- sentence summary on the direction I need to take? Thanks, Wade ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSTableView and OutineView resizing bugs
Hello list, I've found that when enlarging the OutLineView having grouped rows some annoying white vertical lines and other garbage artifacts appear briefly in the newly displayed area. This is most noticeable if the group row happens to display also images (subclassing the NSTextCell to allow this). Is there anything I can do to avoid this? Also putting an image on the right side of the group row causes it to be displayed several times at once while enlarging the view. This can be avoided not showing the rightmost image while resizing (but looks odd). After a lot of tests I've noticed that this bug is greatly reduced if drawsBackground is set to false, but I still can see a white line and a ghost right image while enlarging. While reducing the right image is never shown until the mouse is released... Thanks for listening. Erne. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Undocumented preparedCellAtColumn:-1 row:row
On 22/ago/09, at 00:17, Seth Willits wrote: In some Apple sample code... // If it is a "full width" cell, we don't have to go through the rows NSCell *fullWidthCell = [self preparedCellAtColumn:-1 row:row]; if (fullWidthCell) { } else { } It's not documented what preparedCellAtColumn:-1 returns though. Anyone know for sure? yep! it's the cell that you can return in the delegate method: - (NSCell *)outlineView:(NSOutlineView *)ov dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item { // If we return a cell for the 'nil' tableColumn, it will be used as a "full width" cell and span all the columns Cool Runnings, Erne. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Undocumented preparedCellAtColumn:-1 row:row
On 22/ago/09, at 00:33, Seth Willits wrote: On Aug 21, 2009, at 3:27 PM, Ernesto Giannotta wrote: It's not documented what preparedCellAtColumn:-1 returns though. Anyone know for sure? yep! it's the cell that you can return in the delegate method: - (NSCell *)outlineView:(NSOutlineView *)ov dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item { // If we return a cell for the 'nil' tableColumn, it will be used as a "full width" cell and span all the columns Ah. And that happens when? I guess a group row is probably one case? It's up to you, if you implement this delegate method it will be called before a row is displayed. The first call will have a nil tableColumn parameter (call it column -1) and if you return a valid cell object (note *any* cell you like) that row will be treated as a group row and no other calls will be sent to this method otherwise it'll receive a call for every column of the row and you'll probably want to return the default column cell here like this: return [tableColumn dataCellForRow:[ov rowForItem:item]]; but still could be any other valid cell object. Cool Runnings, Erne. p.s. don't know why my posts to the list are held for approval so don't come up in the list :-( ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Possible reasons why "no help is available"?
Hi. I'm trying to get a Help Book to open for my application. I have a pile of .htm and .css files that were given to me by someone who generated them from Robo Help. I put them in a folder called "XX Help", dropped the folder onto Help Indexer which generated a filed called "XX Help.helpindex" and added it to the folder. I then added step to my build script that copies "XX Help" to Resources/English.lproj in my app bundle. Then I added a key called CFBundleHelpBookFolder with the name "XX Help". Then in my applicationDidFinishLaunching method, I call AHRegisterHelpBook() with the FSRef from my budle. When I call [NSApp showHelp: nil]; in response to the user choosing the help menu item for the app, I get an messagebox that sayd "Help isn't available for XX." I made sure there is a reasonable file called "index.html" in the help book. What should I do to get this to open? 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 arch...@mail-archive.com
Re: NSTableView and OutineView resizing bugs
On Aug 21, 2009, at 1:45 PM, Ernesto Giannotta wrote: After a lot of tests I've noticed that this bug is greatly reduced if drawsBackground is set to false, but I still can see a white line and a ghost right image while enlarging. Have you seen this? http://www.cocoabuilder.com/archive/message/cocoa/2009/3/2/231390 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 arch...@mail-archive.com
Re: checkbox question
On Aug 22, 2009, at 7:08 PM, Quincey Morris wrote: If you did that, you could add a "measurementUnits" property to your window controller: + (NSSet*) keyPathsForValuesAffectingMeasurementUnits { return [NSSet setWithObject: @"state"]; } - (NSString*) measurementUnits { return state ? @"kg" : "lb"; } and then bind each of the text labels to that property. Then when you click the checkbox, all the text labels will change automatically. Very very slickI like that. :-) Thank you so much...in the mean time...have gotten the functionality ( well almost). Thank you again for your time. Much appreciated. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Handling international text without text views
On Aug 22, 2009, at 12:57 PM, Wade Williams wrote: When the application was Carbon, as I recall, I would setup a new TSM document, and that would automatically give me the bottom-line text input bar and I would process the input with my Carbon event handlers. I've been doing some searching on how to accomplish the same thing on Cocoa (enable the bottom-line text entry window and getting events containing the Unicode text), but haven't been able to find anything yet. It appears I might have to do something with NSInputManager, but I haven't really seen how I can accomplish what I want. Not an expert in this field (though I find myself in the bowels of the text system more and more often), but take a look at the protocols NSText and NSTextView implement. I believe the one you want is NSTextInput. As for the bottom bar, that might be a legacy Carbon thing. Cocoa input servers provide their own UI. (But take a look at the stack trace that occurs in -keyDown:. Cocoa creates a TSM document and does all sorts of Carbony things anyway, but you don't get to play with them. Dunno about 64-bit, but you might be able to cross this bridge yourself in 32 bit code.) Some text system engineers participate on this list. Hopefully one of them, or someone else more knowledgable than I am at the moment, can help you out more. Good luck! --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Animation + Garbage Collection
So, it isn't Garbage Collection + Core Animation that is breaking the transition, I just refactored my entire project to remove GC support (big pain) and the animation hasn't changed at all. Now I'm looking at my custom NSView that is being animated and I'm wondering now if that is the problem. Is there anything special I need to do in a custom NSView to enable Core Animation support? -- Evan On Aug 19, 2009, at 3:30 PM, Bill Bumgarner wrote: On Aug 19, 2009, at 10:54 AM, Evan Moseman wrote: I've been trying to get a fairly simple and well documented transition: CIPageCurlTransition to work in my app, but the results are awful. Non filter transitions like kCATransitionFade work fine, but when I try to use a CAFilter for the transition the best I get is dome chopped up image with the wrong geometry and it just looks completely broken. I've been trying to figure out what the cause is, and the only real difference between my app and a few example applications, as far as this code is concerned, is that mine has garbage collection enabled, not required though. I ran into this post with a quick google search: http://blog.fadingred.com/post/80877304/core-animation-and-garbage-collection Further searches in the Core Animation documentation haven't yet revealed a known incompatibility between Core Animation libraries and Garbage Collection. Am I missing something obvious or documented? It should work. File a bug via http://bugreport.apple.com and send me the bug # directly. thanks, b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Possible reasons why "no help is available"?
The of your "index.html" needs some tags like this: BookMacster Help Also, make sure that there is only one file in the Help folder with these tags. If there's more than one, it will fail. If it works, reply and let us know which one or more of those tags is essential to avoid the silent failure you reported. I forgot. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Possible reasons why "no help is available"?
Here's a walkthrough, in case it might be helpful: http://bravobug.com/news/?p=160 On Fri, Aug 21, 2009 at 4:19 PM, Brant Sears wrote: > Hi. I'm trying to get a Help Book to open for my application. > > I have a pile of .htm and .css files that were given to me by someone who > generated them from Robo Help. > > I put them in a folder called "XX Help", dropped the folder onto Help > Indexer which generated a filed called "XX Help.helpindex" and added it to > the folder. > > I then added step to my build script that copies "XX Help" to > Resources/English.lproj in my app bundle. > > Then I added a key called CFBundleHelpBookFolder with the name "XX Help". > > Then in my applicationDidFinishLaunching method, I call AHRegisterHelpBook() > with the FSRef from my budle. > > When I call [NSApp showHelp: nil]; in response to the user choosing the help > menu item for the app, I get an messagebox that sayd "Help isn't available > for XX." > > I made sure there is a reasonable file called "index.html" in the help book. > > What should I do to get this to open? > > 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/bravobug%40gmail.com > > This email sent to bravo...@gmail.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com