Re: Undomanager for custom object?

2012-03-14 Thread Luc Van Bogaert
On 14 Mar 2012, at 20:12, Seth Willits wrote: > On Mar 14, 2012, at 3:26 AM, Luc Van Bogaert wrote: > >> I would like to implement undo/redo for a model object which in turn is also >> a ivar backed property of a document object. I'm already using the >> document's undo manager to undo/redo se

Synchronous multi-image dragging

2012-03-14 Thread Joseph Ranieri
I've got a cross platform codebase that expects drag and drop operations to be performed synchronously, as has always been the case on Mac OS and Windows. Now I'm looking at upgrading us to use the 10.7 multi-image dragging API, but I have the problem of beginDraggingSessionWithItems:event:source:

Re: Memory, Swap used by whom?

2012-03-14 Thread Gerriet M. Denkmann
On 14 Mar 2012, at 23:45, Jens Alfke wrote: > > On Mar 13, 2012, at 11:09 PM, Gerriet M. Denkmann wrote: > >> Is there a Cocoa method which gives me to any (physical) memory address the >> status - like "used by process a" or: "shared by processes a, b, ..., z" or >> "free”? > > Are you real

Re: An approach sought

2012-03-14 Thread Michael de Haan
Thanks for your insight. The only reason for having access to the model, in my case, is that some of the properties are derived. (In my case, 4 properties need to be set (by the user) to derive a final property). But, I do like your approach of simply binding it all to the same source...was not

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Alex Zavatone
Back in the olden days in Director (1995-2001), I actually built an xplat pseudo threading engine in the Lingo language for Director and Shockwave for this exact purpose. There was no robust model for thread locking as I simply said to myself "don't do anything stupid" and "handle your callback

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Wade Tregaskis
> I don't like the idea of a multithreaded aproach by default, because as a > general rule, you > should not make your application multithreaded unless you have a good > reason. a) The reality is that Cocoa already exposes you to a lot of concurrency and asynchronisity, and is only going to do m

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Wade Tregaskis
> The problem of course, is that in order to allow that, the framework itself > has to be locking things all over the place, regardless of whether or not an > app is actually accessing any particular data from multiple threads, because > now the framework has to assume that might happen. Yes an

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
On 3/14/2012 10:27 AM, Scott Ribe wrote: On Mar 14, 2012, at 11:23 AM, JongAm Park wrote: it didn't sound harsh in a jungle with full of male creatures. LOL! And you said your English was not so good. That was great! Well, I was not born in English-speaking country. So, sometimes my English

Re: Making a NSPanel to look active

2012-03-14 Thread Quincey Morris
On Mar 14, 2012, at 03:10 , bassrelig...@free.fr wrote: > I also want the NSWindow to remain the key window so it still receive key > events This is the heart of the problem. By making your panel's table view *look* active, you're making a promise to your users that keystrokes work in the table

Re: nil in cocoa collections

2012-03-14 Thread Ariel Feinerman
We use CCSpriteFrameCache from cocos2d then when the frames a removed from time to time the one or more these "null" values are in the cache 2012/3/14 Jean-Daniel Dupas > > Le 14 mars 2012 à 17:02, Fritz Anderson a écrit : > > > On 14 Mar 2012, at 9:49 AM, Ariel Feinerman wrote: > > > >> I have

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
Well, I'm sorry if I confused you. BTW, "common advice to avoid threading" doesn't mean that threading should not be used. Just like salt, if it is used for right occasion, it is very good. However, when there are another way not to use thread but just to use threading because "it can be used"

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
Yes. I agree. That is one of the approach I'm thinking of when I handled similar issue with QuickTime. Thanks, On 3/14/2012 10:05 AM, Gary L. Wade wrote: On Mar 13, 2012, at 2:09 PM, JongAm Park wrote: In other words, the thread function may want to update UI like inserting a log message to

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 14, 2012, at 2:08 PM, JongAm Park wrote: > Because, as you said, there can be some situation where it is a lot easier > and better to allow accessing GUI widgets from any threads, The problem of course, is that in order to allow that, the framework itself has to be locking things all ove

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Per Bull Holmen
Den 20:00 14. mars 2012 skrev Wade Tregaskis følgende: > On the other hand, you could have an event handling framework which > dispatched events to any of multiple threads/queues/whatever for you.  For > example, each window might have its own queue.  This actually makes a lot > more sense in

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
Well, Mr. Ribe. I'm sorry but I'm not inexperience with this domain. I'm not trying to solve this problem with more complicated model. I was to find out any rationale, I may not think of, behind the new model, and a well-established code pattern to solve it. JongAm Park On 3/14/2012 9:23 AM,

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
On 3/14/2012 9:19 AM, Wade Tregaskis wrote: Threads themselves are very useful; multiple threads taking user input and updating the display to the user are not really useful, and the request for them more often than not betrays a lack of understanding of threading. So you think it'd be great i

Re: Undomanager for custom object?

2012-03-14 Thread Seth Willits
On Mar 14, 2012, at 3:26 AM, Luc Van Bogaert wrote: > I would like to implement undo/redo for a model object which in turn is also > a ivar backed property of a document object. I'm already using the document's > undo manager to undo/redo setting the model object property. Once the > property i

Re: An approach sought

2012-03-14 Thread Seth Willits
On Mar 13, 2012, at 2:28 PM, Michael de Haan wrote: > What I wish to have happen, is a situation where model and view AND last user > value saved and restored using the "bindings" model. > Is this possible? I'm not really 100% sure what you're after here, so I may be off: If you literally wante

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Wade Tregaskis
>> Likewise even event handling is often effectively multi-threaded, because >> you dispatch from the main thread to a variety of tasks, queues or worker >> threads. > > But then you are receiving the events on the main thread? What do you > mean? If you receive events on the main thread, and d

Re: Making a NSPanel to look active

2012-03-14 Thread Seth Willits
On Mar 14, 2012, at 3:10 AM, bassrelig...@free.fr wrote: > I have a NSPanel, containing a NSTableView. > This panel is a child of -and ordered front of- a NSWindow. > I also want the NSWindow to remain the key window so it still receive key > events, but I also want th epanel to remains visible,

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Jean-Daniel Dupas
Le 14 mars 2012 à 17:52, Per Bull Holmen a écrit : > Den 17:19 14. mars 2012 skrev Wade Tregaskis følgende: > >> The reality is of course more of a compromise. It's quite common to do >> drawing across multiple threads, though you still synchronise the final >> "blits" around a single thread

Making a NSPanel to look active

2012-03-14 Thread bassreligion
Hi, I have a NSPanel, containing a NSTableView. This panel is a child of -and ordered front of- a NSWindow. I also want the NSWindow to remain the key window so it still receive key events, but I also want th epanel to remains visible, front window and (most important) look active. Unfortunately

An approach sought

2012-03-14 Thread Michael de Haan
I am sure this must be covered somewhere, but my searches come to nought. Using bindings, I wish to persist the state of an app ( for example, a slider's value). Current test app is thus. A slider, whose value is bound to a "model" float value via an appropriate NSController ( in this case, an

Re: Cocoa-dev Digest, Vol 9, Issue 28

2012-03-14 Thread lpeng...@gmail.com
Re: Get OS version of iOS device connected to Mac OS X (Payal Mundhada) On 2012年1月19日, at 18:40, cocoa-dev-requ...@lists.apple.com wrote: > Get OS version of iOS device connected to Mac OS X > (Payal Mundhada) ___ Cocoa-dev mailing list (Coc

Re: Uncaught Exception: NSUnknownKeyException

2012-03-14 Thread Stefan Miller
On Mar 9, 2012, at 1:35 AM, Graham Cox wrote: > > The key is nil (null). So the problem is where the key is coming from, not > the operation of the Action class. > You could try overriding setValue:forUndefinedKey: (see NSKeyValueCoding Protocol Reference) in your Action class and set a break

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 14, 2012, at 11:05 AM, Gary L. Wade wrote: > To solve your thinking on this matter, conceptualize the background thread as > a (M)odel object, the main thread a (V)iew object, and possibly an > NSMutableArray of NSStrings each having an individual log message being a > (C)ontroller objec

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 14, 2012, at 11:23 AM, JongAm Park wrote: > it didn't sound harsh in a jungle with full of male creatures. LOL! And you said your English was not so good. That was great! -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice _

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
On 3/14/2012 9:14 AM, Scott Ribe wrote: On Mar 14, 2012, at 10:07 AM, Brian Lambert wrote: Scott, it's not that any one thing is hard to get correct. Arrogantly calling someone stupid, as you've done here, doesn't help. I didn't call anyone stupid--that's your inference, not mine. I did poi

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
Umm.. Mr Lambert.. It's OK. I'm not offended. If I confess, I felt a little uncomfortable, because I understand pretty well this kind of stuff but he put an emphasis by saying "mess". But we are talking in a text based media which doesn't convey facial expression or tone of voice. So, based on

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread JongAm Park
Umm.. Mr Lambert.. It's OK. I'm not offended. If I confess, I felt a little uncomfortable, because I understand pretty well this kind of stuff but he put an emphasis by saying "mess". But we are talking in a text based media which doesn't convey facial expression or tone of voice. So, based on

Re: Blocks: object retaining behavior?

2012-03-14 Thread Antonio Nunes
On 14 Mar 2012, at 16:48, Jens Alfke wrote: >> My assumption is that the savePanel will be held on by the block for as long >> as it exists. But now I wonder whether that assumption is correct, and this >> retaining/copying behaviour only happens when the block is copied. > > True, ‘savePanel’

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Gary L. Wade
On Mar 13, 2012, at 2:09 PM, JongAm Park wrote: > In other words, the thread function may want to update UI like inserting a > log message to a text field on a window and thus asking main thread to do so, > and main thread is waiting to acquire a lock or waiting using "Join", then > either the

Cocoaheads meeting tonight in Lake Forest

2012-03-14 Thread Scott Ellsworth
CocoaHeads Lake Forest will be meeting on the second Wednesday of the month. We will be meeting at the Orange County Public Library (El Toro) community room, 24672 Raymond Way, Lake Forest, CA 92630 Please join us from 7pm to 9pm on Wednesday, 3/14 Tonight we will both discuss the new iPad/iOS 5

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Per Bull Holmen
Den 17:19 14. mars 2012 skrev Wade Tregaskis følgende: > The reality is of course more of a compromise.  It's quite common to do > drawing across multiple threads, though you still synchronise the final > "blits" around a single thread (i.e. the main thread). Isn't that still legal? I remember

Re: String Constants the solution

2012-03-14 Thread Jens Alfke
On Mar 14, 2012, at 1:12 AM, Andreas Grosam wrote: > The more OO like approach is to create corresponding sub subclasses for class > "Transport", e.g. AirTransport, GroundTransport, and possibly a factory class > which creates such instances. Yup. I’ve learned over time that “switch(something-

Re: Blocks: object retaining behavior?

2012-03-14 Thread Jens Alfke
On Mar 14, 2012, at 9:26 AM, Antonio Nunes wrote: > My assumption is that the savePanel will be held on by the block for as long > as it exists. But now I wonder whether that assumption is correct, and this > retaining/copying behaviour only happens when the block is copied. True, ‘savePanel’

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Alex Zavatone
On Mar 14, 2012, at 12:07 PM, Brian Lambert wrote: > Scott, it's not that any one thing is hard to get correct. Arrogantly > calling someone stupid, as you've done here, doesn't help. Sounds like you're putting words in Scott's mouth Brian. > On Wed, Mar 14, 2012 at 6:43 AM, Scott Ribe > w

Re: Memory, Swap used by whom?

2012-03-14 Thread Jens Alfke
On Mar 13, 2012, at 11:09 PM, Gerriet M. Denkmann wrote: > Is there a Cocoa method which gives me to any (physical) memory address the > status - like "used by process a" or: "shared by processes a, b, ..., z" or > "free”? Are you really sure you mean “physical” memory address? Physical addres

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Jens Alfke
On Mar 14, 2012, at 9:19 AM, Wade Tregaskis wrote: > Having a UI framework that either offloads some of this for you can actually > be very useful. It would also be closer to the user experience we're trying > to portray - for example, that each document on an app is totally > independent. H

Blocks: object retaining behavior?

2012-03-14 Thread Antonio Nunes
Hi, I'm tracking down the cause of a crash, and am starting to wonder whether my understanding of what gets retained by a block is correct. Lets say that we have the following method: [savePanel beginSheetModalForWindow:self.windowForSheet compl

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 14, 2012, at 10:17 AM, Brian Lambert wrote: > "Ouch. If you think that's a problem, then trust me, you would really make a > mess with multiple UI threads." > > That isn't calling someone stupid? Really? No, it's calling someone inexperienced with the domain and unprepared to deal with

Re: nil in cocoa collections

2012-03-14 Thread Jean-Daniel Dupas
Le 14 mars 2012 à 17:02, Fritz Anderson a écrit : > On 14 Mar 2012, at 9:49 AM, Ariel Feinerman wrote: > >> I have an mystique behavior in the NSMutableDictionary >> >> one cannot while one contains a nil for key and value so when print in >> nslog > > >> { >> "key" = "value"; >> (

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Brian Lambert
"Ouch. If you think that's a problem, then trust me, you would really make a mess with multiple UI threads." That isn't calling someone stupid? Really? Ah, OK. My inference processor must be in error. On Wed, Mar 14, 2012 at 9:14 AM, Scott Ribe wrote: > On Mar 14, 2012, at 10:07 AM, Brian Lam

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Wade Tregaskis
> Threads themselves are very useful; multiple threads taking user input and > updating the display to the user are not really useful, and the request for > them more often than not betrays a lack of understanding of threading. So you think it'd be great it every GUI app shared the same serial q

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 14, 2012, at 10:07 AM, Brian Lambert wrote: > Scott, it's not that any one thing is hard to get correct. Arrogantly > calling someone stupid, as you've done here, doesn't help. I didn't call anyone stupid--that's your inference, not mine. I did point out that someone who thinks he can

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Brian Lambert
Scott, it's not that any one thing is hard to get correct. Arrogantly calling someone stupid, as you've done here, doesn't help. It's the subtlety of getting *everything* correct. A GUI system, and the programs that are layered on top of it, embody a great deal of complexity. Allowing multiple

Re: nil in cocoa collections

2012-03-14 Thread Fritz Anderson
On 14 Mar 2012, at 9:49 AM, Ariel Feinerman wrote: > I have an mystique behavior in the NSMutableDictionary > > one cannot while one contains a nil for key and value so when print in > nslog > { > "key" = "value"; > (null) = (null); > } (Edited for readability) Am I to understand

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 14, 2012, at 9:21 AM, JongAm Park wrote: > Of course. So, it is better to avoid such case, just like threading itself. That's really not what I meant. I meant that if you're at the level that you design things such that the main thread and background worker threads deadlock, adding more

nil in cocoa collections

2012-03-14 Thread Ariel Feinerman
Hi, I have an mystique behavior in the NSMutableDictionary one cannot while one contains a nil for key and value so when print in nslog *{ * ** *"key" = "value"; * ** *(null) = (null); * *} * one is not an NSNull then NSArray *keys = [_f allKeys]; throwing an exception *Terminating

Re: Undomanager for custom object?

2012-03-14 Thread Fritz Anderson
On 14 Mar 2012, at 5:26 AM, Luc Van Bogaert wrote: > On 13 Mar 2012, at 22:07, Kyle Sluder wrote: > >> On Mar 13, 2012, at 1:49 PM, Luc Van Bogaert wrote: >> >>> Hi, >>> >>> In my document-based app, I am using NSDocument's NSUndoManager to >>> implement undo/redo. As part of my document objec

Re: [Q] Why is the threading and UI updating designed to be done only on a main thread?

2012-03-14 Thread Scott Ribe
On Mar 13, 2012, at 3:09 PM, JongAm Park wrote: > In other words, the thread function may want to update UI like inserting a > log message to a text field on a window and thus asking main thread to do so, > and main thread is waiting to acquire a lock or waiting using "Join", then > either the

Re: NSDrawTiledRects Only Draws One Side

2012-03-14 Thread Chris Tracewell
On Mar 13, 2012, at 5:27 PM, Jens Alfke wrote: > > On Mar 13, 2012, at 4:33 PM, Chris Tracewell wrote: > >> NSDrawTiledRects(NSInsetRect(theVendorTextRect,10,10), theVendorTextRect, >> theSides, theGrays, 1); >> NSDrawTiledRects(theBillToTextRect, theBillToTextRect, theSides, theGrays, >> 1);

Re: Undomanager for custom object?

2012-03-14 Thread Luc Van Bogaert
On 13 Mar 2012, at 22:07, Kyle Sluder wrote: > > On Mar 13, 2012, at 1:49 PM, Luc Van Bogaert wrote: > >> Hi, >> >> In my document-based app, I am using NSDocument's NSUndoManager to implement >> undo/redo. As part of my document objects, I have to deal with a custom >> object, for which I w

Re: Memory, Swap used by whom?

2012-03-14 Thread jonat...@mugginsoft.com
On 14 Mar 2012, at 06:09, Gerriet M. Denkmann wrote: > Is there a Cocoa method which gives me to any (physical) memory address the > status - like "used by process a" or: "shared by processes a, b, ..., z" or > "free"? > > And also I would like to know, which processes have things swapped out.

Re: NSTextField not consuming keyDown events; How do I prevent super view from receiving those events?

2012-03-14 Thread jonat...@mugginsoft.com
On 14 Mar 2012, at 00:00, Eric Wing wrote: > I am not calling [super keyDown:event] in my custom subclass. But the > problem is that it is the NSTextField that is passing the event to my > class, not the other way around. I did not subclass NSTextField (nor > do I really want to). > Sorry Eric.

Re: String Constants the solution

2012-03-14 Thread Andreas Grosam
On Mar 9, 2012, at 1:29 AM, Prime Coderama wrote: > I have references to 'ground' and 'air' in multiple files. It is usually used > in this context, but not always. >> if ([transport.type isEqualToString:@"ground"]) { >>// do something for automobiles >> } >> else if ([transport.type isEq