Re: Help to understand how do events work
I'm sorry, i guess i have posted the messages privately before, thinking they are posted to a mailing list. I have used before only forums and don't have enough experience with mailing lists :) Hope this time the message will come to the right destination Hi Jonathan Unfortunately this doesn't work.. sendEvent is called only when i click with the mouse on the window. Keydowns are not dispatched to this method. I am just wondering, what path does the event take to get to the destination control, bypassing somehow the window. I am sure this happens because of the styles i have specified ( 1) when you click on a window, the application doesn't become active; 2) the window is floating on top of all other windows, even if it's not active - NSPopupMenuWindowLevel), but i haven't found any details about event routing in this case.. maybe i could do that by reimplementing the main event loop? Or maybe cocoa framework doesn't send keydowns to my application at all? What is the general conditional for the application to receive keydown events? What if the application doesnt have ordinary key windows? is there still a chance to process such keyDown events on some low level? > Is you window the key window? call NSWindow - makeKeyWindow > Regards yes, for displaying that window i am calling makeKeyAndOrderFront, making it key window. I am not sure if it becomes key though. As i have described, my window is "special" - it doesn't behave like most other cocoa windows. It is situated on the "menu level" (it behaves like menu?) >most events coming into an application make their way to a window in a >sendEvent: message unfortunately, keyDown doesn't come (maybe because the window is not really a "key" one, despite i'm calling makeKeyAndOrderFront). I am only trying to understand where can i (and whether can i) catch the key event. According to that "events programming guide", all events directed to my application come through Main event loop. Thus i could inject some code into my app's runloop and try to extract the events from there (if they, as we see, don't reach the window's -sendEvent)? I don't know how to do that though. What comes on my mind - is installing eventTap to my own application... But that looks a little like an overhead. Do keyDowns come only to those applications which have a keyWindow displayed on a screen? What if my application is active (i clicked its icon on dock), but its window is not a key one? The application's runloop won't get any key down messages? How do popup menus usually process keydown events? are they also "key windows" in cocoa terminology? Thanks again George ___ 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: Documentation Hard Copy?
Hi Tom, No it is not. I often find this with some documents as well. The best solution is to use a laser printer and the hardest bit is getting things printed right on both sides of the page... :) You can probably print anything you like, as long as you're not selling it or otherwise infringing on copyrights (i.e. representing it as your own or something) John On Oct 7, 2010, at 10:07 AM, Tom Davies wrote: > I like the Apple developer documentation, but I would like it in printed form > -- I just find I absorb the tutorials better that way. > > Is it available as hard copy? > > Alternatively, would the licence it's provided under allow me to print the > PDF documentation via a print on demand provider like lulu.com? > > Thanks, > Tom___ > > 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/jjoyce%40apple.com > > This email sent to jjo...@apple.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
Documentation Hard Copy?
I like the Apple developer documentation, but I would like it in printed form -- I just find I absorb the tutorials better that way. Is it available as hard copy? Alternatively, would the licence it's provided under allow me to print the PDF documentation via a print on demand provider like lulu.com? Thanks, Tom___ 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: Any way to synthesize KVC compliant collections?
On 2010 Oct 06, at 10:54, Quincey Morris wrote: > It would also be nice if Xcode had more direct support for inserting > templated accessors (I can never quite remember the form of the accessors, > and getting them slightly wrong is a frustrating exercise in debugging), and > if its Refactor supported these collection accessors, validate and > keyPathsForValuesAffecting, etc. There is a 3rd-party app, Accessorizer, which I think does stuff like 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 arch...@mail-archive.com
Re: Problem connecting to Oracle with app run from XCode
Timothy Mowlem wrote: I can run the XCode built app as well from the command line after setting LD_LIBRARY_PATH (as a non-admin user and without using sudo). If that env-var is the cause, then printf() the value of it in both cases, and manually compare them. Use the getenv() C function. You might also read the Mac OS X man page for 'dyld', if you haven't done so yet. Xcode > Help > Open man Page... -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem connecting to Oracle with app run from XCode
Hello Francis, Thank you for your feedback. I will try and get Wireshark up and running. I have been meaning to get proficient with it for a while so this is a good chance to use it. I don't see why if couldn't sniff any traffic on the LAN so I think it should work. However I very much doubt it is a network issue but rather either a security or an environment issue. I can run the XCode built app as well from the command line after setting LD_LIBRARY_PATH (as a non-admin user and without using sudo). It worked with the firewall activated on both MacOSX and CentOS. Best Regards, Tim Mowlem On 06 Oct 2010, at 11:45, Francis Devereux wrote: > On 6 Oct 2010, at 00:07, Timothy Mowlem wrote: > >> Hello, >> >> I am trying to get OCILib (http://orclib.sourceforge.net/), a free Oracle >> library, running on MacOSX. I have built the library from source and >> successfully run a test class via the terminal containing the example code >> in the OCILib documentation. As an experiment I have created a Cocoa app in >> XCode and dumped the code in the test class in the App delegate's >> applicationDidFinishLaunching method. >> >> However when I run the app from within XCode I get the following error: >> >> ORA-12170: TNS:Connect timeout occurred >> >> Has anyone tried anything similar or seen a similar problem? > > No, but since it seems to be a network connection timeout you could try > running a packet sniffer (e.g. Wireshark) to help you to see what's > happening. See what network communication (if any) happens when you run the > command-line version and the Cocoa app version. > >> Oracle 10 XE running on a CentOS 5.5 VM in VMWare Fusion > > I'm not sure whether Wireshark can capture host<->VM traffic. > > Francis ___ 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: what are the scenarios for an app to be terminated?
On Oct 6, 2010, at 12:13 PM, eveningnick eveningnick wrote: > Now i am wondering, how can i correctly "release" myobject (i.e. make > its -dealloc called) You don't care if it gets deallocated. Really. Snow Leopard supports "sudden termination" which means that it's possible that your application can *instantly* be terminated without a single method being called. This only happens if your process supports sudden termination (a plist option) and is in the "can suddenly terminate state" (determined by you). This means you don't want to rely on objects being deallocated before quit. Even without sudden termination, many objects already aren't deallocated. I don't fully remember the process, but basically the app will check for unsaved windows, send the few delegate methods to resolve them, close them all, send a message to the app delegate, and if is all is well, it'll instantly terminate. Your app delegate, and some other top-level controllers won't be deallocated before the process exists because it's pointless. So what you could care about is simply when the process is going to terminate so you can perform some last minute operation. (It's probably a better idea to not rely on doing it at the last minute, though.) To get the notification, you just watch for NSApplicationWillTerminateNotification to be sent (eg applicationWillTerminate: in your app delegate). You can do the details there. Anytime your application is quit, that will be called. Anytime your application is force-quit, it won't, but that's the point of force quitting. -- Seth Willits ___ 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
what are the scenarios for an app to be terminated?
Hello! What are all the scenarios for terminating the Cocoa application, and can i catch the moment of quitting and do some "before quit" actions? I am writing a "naked" cocoa application (basically for myself, to understand what happens under the hood). So, instead of calling NsApplicationMain, i do the following: NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSApplication *app = [NSApplication sharedApplication]; MyClass *myobject = [[[MyClass alloc] init] autorelease]; [app run]; [pool drain]; //or release return 0; Now i am wondering, how can i correctly "release" myobject (i.e. make its -dealloc called) in as more "quitting scenarios" as possible - for example, by clicking "with the right mouse button" app's icon on dock and selecting "quit" there, by pressing Ctrl+C in terminal, by sending kill signal... I guess i should intercept some events from the main event loop, but my superficial knowledge of "under-the-hood-things" don't let me to understand what exactly should i do :) How is it done in Cocoa framework by NSApplicationMain? And what is the right way to terminate application, so it would release all its allocated objects? Maybe it's a wrong way to use -dealloc also as a destructor (like i did in C++) - where i save config file? what is the right way? Thanks for the answers ___ 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: Let the runloop process its queue during a long operation
On Wed, 6 Oct 2010 15:53:13 +0400, eveningnick eveningnick said: >Hello >I have an application that transforms a very big file, and during that >operation i want to give a chance to user to press Esc and cancel this >transformation. You're going to use a secondary thread and that's that. I would second the advice to use NSOperation. I hesitated and hesitated and then went for it, and it turned out to be very easy, much easier and far less "close your eyes and think of England" than NSThread. m. ___ 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
NanoStore has moved to Google Code
Hello everyone, Based on feedback from other developers, I have decided to move NanoStore, a Cocoa wrapper for SQLite, to Google Code: http://code.google.com/p/nanostore/ The Sourceforge repository is now considered obsolete and will be removed shortly. Regards, -- Tito ___ 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
Preventing a window from moving while dragging a view.
I have a NSPanel with a NSToolbar and a tabless NSTabView to create an inspector. The NSToolbarItems for the NSToolbar use a custom view. This all works as expected. I am trying to implement drag/drop to move toolbar items to/from different Inspector Panels to allow the user to customize their inspectors. I've added the needed mouseDown and mouseDragged method in addition to the draggingSourceOperationMaskForLocal:. When the drag operation begin during the mouseDragged: event, the NSPanel window is moving as well. I am not calling the super implementation. Question: How do I prevent the Panel from moving during the drag operation? Do I need to use a modal loop? Thanks! Tony Romano http://www.cocoaegghead.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Any way to synthesize KVC compliant collections?
On Oct 6, 2010, at 10:03, Citizen wrote: > I was hoping it would provide me with less code to write and maintain. Make > it easier for me to support code for both garbage collected and reference > counted environments. And provide me with KVO compliant accessors. ;-) I'd be interested to see, if you'd care to take the time, an example of what the source code might look like if such a feature existed. It would also be nice if Xcode had more direct support for inserting templated accessors (I can never quite remember the form of the accessors, and getting them slightly wrong is a frustrating exercise in debugging), and if its Refactor supported these collection accessors, validate and keyPathsForValuesAffecting, etc. ___ 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: JDBC from Cocoa or the like
I have made freetds work on iOS. It is doable, and it is usable. I never did anything with it because greeted is gpl, so turning it into a commercial product on the AppStore presented non technical "challenges". I also have PostgreSQL client Libraries working on iOS. If you want help with this, I will be happy to talk about it, but ODBC is, IMO a bad fit for iOS at many levels. In truth I think all traditional DBMS toolkits have issues in the long run on iOS. They are fine so long as the devices are on wifi within the walls. Once they go outside the walls, and you go from wifi bandwidth and latency levels to 3G or edge, these models quickly become horrible fits with the iOS model. The problem is that *all* of the protocols, be it TDS, ODBC (which for MSSQL is still TDS), libpq, et al are designed for low latency, high bandwidth connections. They are chatty and are not optimized for running over spotty and intermittent 3g connections. A VPN does not fix the fundamental weaknesses in the wire protocols. Any MSSQL admin that has more than a couple of years of experience has seen the intermittent SSPI and connection drop errors that happen on LAN's when you get a lot of line noise (a saturated hub will often timeout otehr computers on the same hub). Because of this, I strongly advocate n-tier solutions for iOS devices, but I understand the reasons that they are often not options. That is why I have done the legwork on other options. If MSSQL is your destination, then FreeTDS is your best option. You may/probably will need to work with FreeTDS.org to obtain a commercial usable license, but in terms of usability and perfomance, it is fine (within reason). Please do not misunderstand me, I am probably one of the biggest RDBMS advocates in this community (PostgreSQLforMac, ODBCKit, PGSQLKit, and the unreleased TDSKit are all my projects), but when it comes to iOS, I just do not feel that the existing client libraries are the best solution. Andy 'Dru' Satori On Oct 6, 2010, at 10:47 AM, colors wrote: > Alex, > > I have the same problem you document below, so looked into your ODBC > reference. However, it looks like they want to sell me a $2000 router > software package to work with the iOS. What I need is a framework (much like > easyDB, but allowed to be used on a commercial product). Did I miss-read the > web site? > > Rich > > On Oct 5, 2010, at 9:39 AM, Alex Kac wrote: > >> I saw this ODBC framework for iOS. Maybe that helps as well: >> http://www.prlog.org/10938886-open-database-connectivity-odbc-arrives-for-apple-ipad-iphone-and-ipod-touch.html >> >> One problem I've always had with the N-tier arch is that of customer >> security. Many companies simply won't use an app that doesn't talk directly >> to the database within their own private VPN/network. >> >> On Oct 5, 2010, at 11:09 AM, Kyle Sluder wrote: >> >>> On Tue, Oct 5, 2010 at 9:03 AM, colors wrote: Is there a framework, or set of APIs or samples available from Apple or others to do SQL server accesses? I have looked at easyDB, but its license makes it a non-starter. I have also looked at freetds, but it does not look like it is ready for prime time (let along particularly good in the Mac support arena). To make maters a little harder, I need to have it work on the iOS too. >>> >>> If you didn't need it to work on iOS, you could use ODBC. >>> >>> Why not adopt a classic N-tier architecture, and have a service with >>> which your apps can communicate rather than having them talk to the DB >>> directly? >>> >>> --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/alex%40webis.net >>> >>> This email sent to a...@webis.net >> >> Alex Kac - President and Founder >> Web Information Solutions, Inc. >> >> "Forgiveness is not an occasional act: it is a permanent attitude." >> -- Dr. Martin Luther King >> >> >> >> > > ___ > > 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/dru%40druware.com > > This email sent to d...@druware.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/a
Re: NSImage is Caching
Thanks for the suggestions, I did try that and -recache as well but neither works. I really think this has to be related to the URL caching but I am not sure where to start. I've been diggin through NSURL, NSURLConnection and NSURLCache but have yet to find the solution. -chris On Oct 6, 2010, at 4:45 AM, slasktrattena...@gmail.com wrote: > NSImage has a -setCachePolicy: (?) method. Not sure if it's the right > name, but you can look it up in the docs. > > On Tue, Oct 5, 2010 at 11:46 PM, Chris Tracewell wrote: >> I have an NSImageView that accepts an image drop then sizes the image and >> ftp's it to a web server. The image view is bound to myObject.myImage >> property which set by a window controller calling its loadMyImage every time >> the window opens... >> >> >> -(void)loadMyImage >>{ >>NSImage *theImage = [[NSImage alloc] initWithContentsOfURL: theURL]; >>[self setMyImage: theImage]; >>} >> >> The problem is that the image is being cached and I cannot figure out how. I >> can drop images galore and it ftp's them to their final destination --> >> which is where the image is loaded from. However, the image will stay the >> same even when I destroy myObject, create another one and it calls >> loadMyImage method again. Even between application restarts. >> >> This must be a setting in NSURL or NSURLConnection or NSURLCache, anyone >> have a clue as to where to start? FWIW - my web browser always shows the >> freshest image. >> >> Thanks in advance. >> >> -- 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/slasktrattenator%40gmail.com >> >> This email sent to slasktrattena...@gmail.com >> > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOutlineView multi cell type binding query
Quincey pretty much got it right. Here's what happens: Table needs a cell (to draw, edit, type select, etc). It calls -preparedCellAtColumn:row: -- this is a public funnel point, and can be overridden. Some examples on the dev site do this. preparedCellAtColumn:row does this, in this order (which may change slightly from release to release): * Return the tracking or editing cell (which was copied), if it is that given row/column. No modifications to the cell are done. * Acquires a cell, via: 1. Asking the delegate, 2. if nil, call [tableColumn dataCellForRow:] (this returns what was set in the nib) * Sets the object value, as returned from the datasource (if applicable) * Calls into bindings to fill up the cell with bound data; this potentially overwrites the objectValue * Sets properties on the cell, such as highlighted, backgroundStyle, showsFirstResponder * Lastly, calls -willDisplayCell, where you get a chance to overwrite any values set by the tableview. corbin On Oct 6, 2010, at 3:50 AM, jonat...@mugginsoft.com wrote: > > On 6 Oct 2010, at 11:29, Quincey Morris wrote: > >> >> This all means that anything you choose to configure in #1 may or may not >> still be in effect by the time you get to #2, but that's an implementation >> detail on which you cannot rely, because there's no API contract that >> anything is kept. >> > This seems to be an inescapable conclusion. I can configure certain aspects > of the cell in #1 but seemingly not others. > Perhaps the cell copying on edit/tracking that Corbin referred to has an > influence here. > But as you say, it's all dependent on the opaque detail of the implementation. > >> >> In many cases, #1 and #2 will be called in lockstep pairs, so it might seem >> that you could configure your cell in either place. However, because the >> delegates have separate purposes, configuration should be reserved for #2 >> only. >> > I agree. Identify the cell type in #1. > Configure it in #2. > > Thanks for taking the time to help clarify my murky thoughts on this. > > Regards ___ 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: JDBC from Cocoa or the like
Alex, I have the same problem you document below, so looked into your ODBC reference. However, it looks like they want to sell me a $2000 router software package to work with the iOS. What I need is a framework (much like easyDB, but allowed to be used on a commercial product). Did I miss-read the web site? Rich On Oct 5, 2010, at 9:39 AM, Alex Kac wrote: > I saw this ODBC framework for iOS. Maybe that helps as well: > http://www.prlog.org/10938886-open-database-connectivity-odbc-arrives-for-apple-ipad-iphone-and-ipod-touch.html > > One problem I've always had with the N-tier arch is that of customer > security. Many companies simply won't use an app that doesn't talk directly > to the database within their own private VPN/network. > > On Oct 5, 2010, at 11:09 AM, Kyle Sluder wrote: > >> On Tue, Oct 5, 2010 at 9:03 AM, colors wrote: >>> Is there a framework, or set of APIs or samples available from Apple or >>> others to do SQL server accesses? I have looked at easyDB, but its license >>> makes it a non-starter. I have also looked at freetds, but it does not >>> look like it is ready for prime time (let along particularly good in the >>> Mac support arena). To make maters a little harder, I need to have it work >>> on the iOS too. >> >> If you didn't need it to work on iOS, you could use ODBC. >> >> Why not adopt a classic N-tier architecture, and have a service with >> which your apps can communicate rather than having them talk to the DB >> directly? >> >> --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/alex%40webis.net >> >> This email sent to a...@webis.net > > Alex Kac - President and Founder > Web Information Solutions, Inc. > > "Forgiveness is not an occasional act: it is a permanent attitude." > -- Dr. Martin Luther King > > > > ___ 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: Let the runloop process its queue during a long operation
On Oct 6, 2010, at 1:53 PM, eveningnick eveningnick wrote: > Hello > I have an application that transforms a very big file, and during that > operation i want to give a chance to user to press Esc and cancel this > transformation. Therefore i need to make mainRunLoop run inbetween > some "phases" of the file transformation. It will be much easier to use a custom subclass of NSOperation for this kind of problem. The operation's -main method should perform the transformation in a peace-wise manner and thereby repeatedly checking its cancelation state (-isCancelled method), like: - (void) main { // runs on a secondary thread NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; ... while (![self isCancelled] && !done) { // transform a peace of data ... } [delegate fileTransformOperationDidFinish:self]; [pool release]; } You add the operation to a NSOperationQueue instance which schedules its operations onto a secondary thread. From your main thread you may then cancel the operation by sending it the -cancel message. There are several ways to notify the application (or some object) when the task is finished. Using a delegate is safe and easy. You may consider to define a protocol for the delegate. The delegate method may also schedule its actual work to the main thread (via -performSelectorOnMainThread:withObject:waitUntilDone:) if this is necessary. Just be careful when your task requires itself a runloop (e.g. using asynchronous NSURLConnection) - since there exists no (implicit) one when invoking an NSOperation's -main method on a secondary thread. Properly implementing this will require more elaborated code, though. Andreas ___ 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: Help to understand how do events work
On 6 Oct 2010, at 12:39, eveningnick eveningnick wrote: > Hello! > I have created a cocoa application that has unusual behavior: it has a > window (NSPanel), which does not activate the application, when it's > clicked. This window is ordered always on top of the other windows. So > it's like a "tooltip" window (basically it is a popup thing, that > drops down when a user types some combination of symols in another > application - which is a texteditor). > Anyway, i did it as following: > NSPanel *popupWindow = [[NSPanel alloc] > initWithContentRect:NSMakeRect(100,100,300,100) > styleMask:NSNonactivatingPanelMask | NSTitledWindowMask > backing:NSBackingStoreBuffered defer:NO]; > [popupWindow setLevel:NSPopupMenuWindowLevel]; > > then i am showing it: > [popupWindow makeKeyAndOrderFront:nil]; > > This "window" behaves as expected: it is displayed on top of all > others, even if it's Application (in Dock, for ex) is not active. It > also dispatches all the clicks on controls (like NSPushButton's) to > these controls. > > The problem for me is that i want to receive keyDown events with it. Have a look at NSWindow -sendEvent: If you subclass your window you can override -sendEvent: and access the event stream like so: /* send event This action method dispatches mouse and keyboard events sent to the window by the NSApplication object. */ - (void)sendEvent:(NSEvent *)event { // look for key down if ([event type] == NSKeyDown) { // process the event } [super sendEvent:event]; } Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Let the runloop process its queue during a long operation
> Can i make a runloop run only one time through the queue, and then > return back to processing of that big file? See CFRunLoopRunInMode(), specifically the returnAfterSourceHandled argument. ___ 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
Let the runloop process its queue during a long operation
Hello I have an application that transforms a very big file, and during that operation i want to give a chance to user to press Esc and cancel this transformation. Therefore i need to make mainRunLoop run inbetween some "phases" of the file transformation. There's an idea to create a separate "fileprocessing" thread that will do onmly one job - transformation of that file, while the main thread (that has the mainRunLoop) will only watch keypresses and when it detects Esc, it kills that "fileprocessing" thread (or something like that). I am wondering if i could do that "in one thread", i.e. inbetween transformation phases (for example, each phase - is a transformation of 1 Kb of text) i call [mainRunLoop run], and the mainRunLoop processes the event queue, and then gets back to work - continues processing, if no Esc has been detected. Here's what i can't understand: a call of [mainRunLoop run] will never return, because what i do - is launch of infinite loop. I've been adviced to use [runUntilDate], but i can't know how much time will it be needed to process the whole event queue. If i specify a little (say, [NSDate dateWithTimeIntervalSinceNow:0.001]), it may not be sufficient. If i specify a lot (like, 1 sec) - it's just a waste of processing time. If i specify [NSDate date] it seems like the queue isn't processed at all... Can i make a runloop run only one time through the queue, and then return back to processing of that big file? 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: NSImage is Caching
NSImage has a -setCachePolicy: (?) method. Not sure if it's the right name, but you can look it up in the docs. On Tue, Oct 5, 2010 at 11:46 PM, Chris Tracewell wrote: > I have an NSImageView that accepts an image drop then sizes the image and > ftp's it to a web server. The image view is bound to myObject.myImage > property which set by a window controller calling its loadMyImage every time > the window opens... > > > -(void)loadMyImage > { > NSImage *theImage = [[NSImage alloc] initWithContentsOfURL: theURL]; > [self setMyImage: theImage]; > } > > The problem is that the image is being cached and I cannot figure out how. I > can drop images galore and it ftp's them to their final destination --> which > is where the image is loaded from. However, the image will stay the same even > when I destroy myObject, create another one and it calls loadMyImage method > again. Even between application restarts. > > This must be a setting in NSURL or NSURLConnection or NSURLCache, anyone have > a clue as to where to start? FWIW - my web browser always shows the freshest > image. > > Thanks in advance. > > -- 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/slasktrattenator%40gmail.com > > This email sent to slasktrattena...@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
Help to understand how do events work
Hello! I have created a cocoa application that has unusual behavior: it has a window (NSPanel), which does not activate the application, when it's clicked. This window is ordered always on top of the other windows. So it's like a "tooltip" window (basically it is a popup thing, that drops down when a user types some combination of symols in another application - which is a texteditor). Anyway, i did it as following: NSPanel *popupWindow = [[NSPanel alloc] initWithContentRect:NSMakeRect(100,100,300,100) styleMask:NSNonactivatingPanelMask | NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO]; [popupWindow setLevel:NSPopupMenuWindowLevel]; then i am showing it: [popupWindow makeKeyAndOrderFront:nil]; This "window" behaves as expected: it is displayed on top of all others, even if it's Application (in Dock, for ex) is not active. It also dispatches all the clicks on controls (like NSPushButton's) to these controls. The problem for me is that i want to receive keyDown events with it. But i am not sure if it is possible: in Apple documentation i found that NSWindow (and NSPanel therefore) have keyDown method (that i tried to override, having created a child class from NSPanel). But in vain - this method is never called. Neither is called mouseDown. How do buttons on this "panel" successfully receive mouseDowns then, for example? Or, after i placed on this panel an NSPushButton, i have seen that its dropdown list's cursor is positioned according to the key pressed on a keyboard - this means it processes keyDowns as well. But how? Could i process these events (keyDown) too? Maybe i should make a child class of NSApplication and rewrite -run method, watching for keydowns? What is the "route" that events go in my case? Thanks for the 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 arch...@mail-archive.com
Re: Any way to synthesize KVC compliant collections?
On Oct 6, 2010, at 03:18, Citizen wrote: > Is there any way to synthesize (using @synthesize) KVC compliant collections? > > I know there are scripts in the Xcode scripts menu to generate declarations > and definitions along the lines of: > > - (NSArray *) myArray; > - (unsigned) countOfMyArray; > - (id) objectInMyArrayAtIndex:(unsigned)theIndex; > - (void) getMyArray:(id *)objsPtr range:(NSRange)range; > - (void) insertObject:(id)obj inMyArrayAtIndex:(unsigned)theIndex; > - (void) removeObjectFromMyArrayAtIndex:(unsigned)theIndex; > - (void) replaceObjectInMyArrayAtIndex:(unsigned)theIndex withObject:(id)obj; > > But is there a way to use properties to generate these methods? No, @synthesize cannot generate these methods. However, it's not entirely clear what you are expecting/hoping will happen. Unlike accessors (getters/setters) for scalar properties, these accessors are optional (roughly -- these methods must be implemented in certain combinations to be recognized), so synthesized methods don't seem useful. If you need the methods at all, then you need custom code in them that can't be synthesized. Are you running into a specific difficulty? BTW, you left one method out of your list: (void) setMyArray: (NSArray*) theArray; It's also worth keeping in mind that due to a historical irregularity (design flaw), if you implement the myArray getter you can't use the NSArray proxy object that's normally returned by valueForKey:@"myArray" -- when you've implemented countOfMyArray/objectInMyArrayAtIndex: -- so in those circumstances you have to return a real array or write your own proxy. One final quibble: The type of all the index parameters is NSUInteger, not unsigned. ___ 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: NSOutlineView multi cell type binding query
On 6 Oct 2010, at 11:29, Quincey Morris wrote: > > This all means that anything you choose to configure in #1 may or may not > still be in effect by the time you get to #2, but that's an implementation > detail on which you cannot rely, because there's no API contract that > anything is kept. > This seems to be an inescapable conclusion. I can configure certain aspects of the cell in #1 but seemingly not others. Perhaps the cell copying on edit/tracking that Corbin referred to has an influence here. But as you say, it's all dependent on the opaque detail of the implementation. > > In many cases, #1 and #2 will be called in lockstep pairs, so it might seem > that you could configure your cell in either place. However, because the > delegates have separate purposes, configuration should be reserved for #2 > only. > I agree. Identify the cell type in #1. Configure it in #2. Thanks for taking the time to help clarify my murky thoughts on this. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.com___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Problem connecting to Oracle with app run from XCode
On 6 Oct 2010, at 00:07, Timothy Mowlem wrote: > Hello, > > I am trying to get OCILib (http://orclib.sourceforge.net/), a free Oracle > library, running on MacOSX. I have built the library from source and > successfully run a test class via the terminal containing the example code in > the OCILib documentation. As an experiment I have created a Cocoa app in > XCode and dumped the code in the test class in the App delegate's > applicationDidFinishLaunching method. > > However when I run the app from within XCode I get the following error: > > ORA-12170: TNS:Connect timeout occurred > > Has anyone tried anything similar or seen a similar problem? No, but since it seems to be a network connection timeout you could try running a packet sniffer (e.g. Wireshark) to help you to see what's happening. See what network communication (if any) happens when you run the command-line version and the Cocoa app version. > Oracle 10 XE running on a CentOS 5.5 VM in VMWare Fusion I'm not sure whether Wireshark can capture host<->VM traffic. Francis ___ 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: -[NSColor setBackgroundColor:] not working in 10.6
Typo in the subject line; it should've read: -[NSImage setBackgroundColor:] not working in 10.6 Hamish -- Hamish Sanderson Production Workflow Developer Sun Branding Solutions Ltd Tel: +44(0)1274 200 700 www.sunbrandingsolutions.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSOutlineView multi cell type binding query
On Oct 6, 2010, at 02:58, jonat...@mugginsoft.com wrote: > What does work is: > > 1. in - outlineView:dataCellForTableColumn:item: construct my popup cell > when required. > 2.in - outlineView:willDisplayCell:forTableColumn:item: select item in popup > cell according to model. > > In step 1 I construct my cell and select the item that corresponds to my > model. > This selection is not respected when the cell is drawn unless I implement > step 2. > I don't quite understand this as the cell is being configured on a per item > basis. AFAIK the purpose of these delegate methods is as follows: 1. outlineView:dataCellForTableColumn:item: is responsible for customizing the management (creation, caching, etc) of possibly persistent cells, deciding things like how many cells are kept around and how they're shared between rows, columns and the table as a whole. This method is *not* responsible for configuring the cell for any individual use. You don't even know for sure that the cell being requested is actually going to be used imminently for drawing. 2. outlineView:willDisplayCell:forTableColumn:item: is responsible for customizing the properties of whatever cell has been chosen (by built-in behavior or by delegate method #1) for a specific table/column/row combination. AFAIK, certain cell properties such as the object value are configured by the table for the cell chosen for a specific column/row combination *after* #1 but *before* #2. In other words, the cell is not configured before #1, nor is it expected to be configured by #1. It is given a default configuration before #2, which means that #2 needs only to re-configure properties that require non-default values. This all means that anything you choose to configure in #1 may or may not still be in effect by the time you get to #2, but that's an implementation detail on which you cannot rely, because there's no API contract that anything is kept. Therefore what you have said you're doing sounds to me like *exactly* the correct approach for #2, but your #1 shouldn't even be trying to set up the cell's selected index. In many cases, #1 and #2 will be called in lockstep pairs, so it might seem that you could configure your cell in either place. However, because the delegates have separate purposes, configuration should be reserved for #2 only. That's how I understand it, anyway. ___ 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: NSOutlineView multi cell type binding query
> > I think it is your misunderstanding of what is going on. > > When the user interacts with a cell (editing, or tracking - in this case, > tracking is happening), the cell is copied. This is required, if you think > about it, since you don't want to have any other cells in the table be > redrawn with that cell that is in the middle of being edited/tracked. After > editing, the regular cell is used again to do drawing for that row/column. > The edited cell needs to be redrawn; you can use - > (void)reloadDataForRowIndexes:(NSIndexSet *)rowIndexes > columnIndexes:(NSIndexSet *)columnIndexes, which in 10.6 basically just does > a setNeedsDisplayInRect:. > > corbin > Thanks for the reply Corbin. I had not deduced the need for the cell to be copied. I am still somewhat uncertain about the exact logic here. I thought that perhaps the dataSource would be queried for cells that don't support the designated NSTableColumn value binding but that doesn't seem to be the case. Calling -reloadData after I have updated the model in the NSButtonCell action doesn't cause the cell to be redrawn correctly for what ever configuration I have adopted. What does work is: 1. in - outlineView:dataCellForTableColumn:item: construct my popup cell when required. 2.in - outlineView:willDisplayCell:forTableColumn:item: select item in popup cell according to model. In step 1 I construct my cell and select the item that corresponds to my model. This selection is not respected when the cell is drawn unless I implement step 2. I don't quite understand this as the cell is being configured on a per item basis. Anyhow, it seems best to leave all configuration of the cells state to step 2. Regards Jonathan Mitchell Developer Mugginsoft LLP http://www.mugginsoft.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
-[NSColor setBackgroundColor:] not working in 10.6
Hi, I have a simple test app that reads a PDF file into an NSImage, sets its background color to white, and draws it into an NSView subclass: @implementation CTView - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"img" ofType:@"pdf"]]; img = [[NSImage alloc] initWithContentsOfURL: url]; [img setBackgroundColor: [NSColor whiteColor]]; } return self; } - (void)drawRect:(NSRect)rect { NSRect bounds = {{0,0}, {[img size].width * 1.5, [img size].height * 1.5}}; [[NSColor blueColor] drawSwatchInRect:rect]; [img drawInRect:rect fromRect:bounds operation:NSCompositeCopy fraction:1]; } @end When run on 10.5, the transparent portions of the PDF are filled with white as intended. On 10.6, however, the transparent portions appear black (or transparent if the view is CA-enabled). Any ideas why it's not behaving on 10.6? Thanks, Hamish -- Hamish Sanderson Production Workflow Developer Sun Branding Solutions Ltd Tel: +44(0)1274 200 700 www.sunbrandingsolutions.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