Re: Failing in -init

2011-07-26 Thread Rick Mann
Thanks much!

On Jul 26, 2011, at 23:42 , Roland King wrote:

> Yes and yes. Read the paragraph titled "handling initialization failure" in 
> "the objective-c programming language" which covers this. 
> 
> 
> 
> On Jul 27, 2011, at 14:28, Rick Mann  wrote:
> 
>> If my object's initialization fails, can I return nil from it? If that 
>> happens, do I need to call [self release]?
>> 
>> -- 
>> Rick
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
>> 
>> This email sent to r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Failing in -init

2011-07-26 Thread Roland King
Yes and yes. Read the paragraph titled "handling initialization failure" in 
"the objective-c programming language" which covers this. 



On Jul 27, 2011, at 14:28, Rick Mann  wrote:

> If my object's initialization fails, can I return nil from it? If that 
> happens, do I need to call [self release]?
> 
> -- 
> Rick
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
> 
> This email sent to r...@rols.org
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Failing in -init

2011-07-26 Thread Rick Mann
If my object's initialization fails, can I return nil from it? If that happens, 
do I need to call [self release]?

-- 
Rick

___

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


Two NSTableViews, two data sources, one data model?

2011-07-26 Thread Izak van Langevelde
I currently have a single NSDocument subclass, which is also a data source for 
two different tables. Because the two tables show different aspects of the data 
and the code gets a little cluttered up, I am thinking about implementing two 
separate data sources, one for each table, both fetching its data from the same 
data model. 

The only way I see right now, is keep the data model in the NSDocument 
subclass, and to connect both data sources to the File Owner, which is a Window 
Controller, and from there access the document. Is there a more direct way of 
achieving this?
---
Grinnikend door het leven...

___

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: How to implement Autosaving, Browsing Versions, Reverting to Last Saved in Lion?

2011-07-26 Thread Zorg
I've just realized I forgot to CC my message to the mailing list.

On Jul 26, 2011, at 7:41 PM, Zorg wrote:

> Okay, thanks. I filed it as rdar://9845409
> 
> -Zorg:-.
> 
> On Jul 26, 2011, at 2:00 PM, Kevin Perry wrote:
> 
>> There is nothing that you are obviously doing wrong here. Please file a 
>> Radar with your test app attached.
>> 
>> -KP
>> 
>> On Jul 24, 2011, at 7:46 PM, Zorg wrote:
>> 
>>> I'm having a difficult time figuring out how to implement these features 
>>> correctly in Lion. I've created a very simple NSDocument based test app: 
>>> http://pastebin.com/w396Xxi4
>>> 
>>> A document in this test app has a window and a text field, the user enters 
>>> text in the text field, that text is the "state" of the document. The app 
>>> saves and loads that text.
>>> 
>>> I'm saving the data using dataOfType: error: and loading the data using 
>>> readFromData: ofType: error:. The user interface (the text field in 
>>> particular) is being updated after being loaded in 
>>> windowControllerDidLoadNib: unless the data is being reverted, in which 
>>> instead the user interface is being updated in readFromData: ofType: error: 
>>> (to test if a document is being reverted, I check if an outlet such as the 
>>> textField != nil)
>>> 
>>> Now, the saving of the document works fine. Browsing and choosing a 
>>> different saved version of the document also works fine. What doesn't work 
>>> correctly is reverting to another version. For example, if I create a new 
>>> document, save the document, make a change (entering something new in the 
>>> text field and hitting enter), choose revert to last saved version from the 
>>> window titlebar, and save again, I occasionally get an error message "This 
>>> document's file has been changed by another application since you opened or 
>>> saved it." or I get "The location of the document - cannot be 
>>> determined." (I say occasionally because I cannot get it to error the first 
>>> attempt I do this while a document is still open, but usually always get an 
>>> error on my second, and further attempts). I can also reproduce this error 
>>> when trying to save after choosing a different version in the versions 
>>> browser, however, I think I can only reproduce the error in this case when 
>>> my document is in an edited state before trying to choose another version 
>>> (If I save before trying to choose a different version and then save after, 
>>> I don't get get an error).
>>> 
>>> Here's a couple images of the errors:
>>> http://dl.dropbox.com/u/10108199/error1.png
>>> http://dl.dropbox.com/u/10108199/error2.png
>>> 
>>> Also, is there a better approach to loading a reverted document than what 
>>> I'm doing (instead of testing if an outlet of a document is nil)? Any help 
>>> would be appreciated.
>>> 
>>> Thanks,
>>> -Zorg:-.___
>>> 
>>> 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/kperry%40apple.com
>>> 
>>> This email sent to kpe...@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


Safari 5.1 update

2011-07-26 Thread Nava Carmon
Hi

New Safari 5.1 doesn't run WebKit plugins! I read that it's supposed to happen 
from 10.7, I'm running 10.6.8. Apple recommends using netscape style plugins. 
Did somebody bump into this already?

Nava Carmon
ncar...@mac.com

"Think good and it will be good!"

___

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: NSTask oddity with getting stdout

2011-07-26 Thread Scott Ribe
On Jul 26, 2011, at 5:52 PM, Shane Stanley wrote:

>> Maybe you should try to re-open your bug ;-)
> 
> I did, but no reply.

Too bad, since it seems to me the person who responded didn't know what they 
were talking about.

> In Snow Leopard that worked fine; a notification would be sent when new data
> was written to the file. In Lion, as soon as it's called it goes into a
> loop; each time readInBackgroundAndNotify is sent, a new notification comes
> straight back.

An actual file? I'm reading from a pipe, so that could be one difference.

I would expect that to go into a loop once a data of length 0 comes in, but not 
before.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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: NSFileManager - a cautionary tale

2011-07-26 Thread Kyle Sluder
On Tue, Jul 26, 2011 at 6:51 PM, Graham Cox  wrote:
>
> On 27/07/2011, at 11:14 AM, Graham Cox wrote:
>
>> This call to mkdir causes the App Store reviewers to have conniptions, even 
>> though it certainly fails.
>
>
> Another thing to mention - we run this code during app launch, so we didn't 
> see it in fs_usage, which requires that the process it's peeking at is 
> running already. I'm not sure if there is a way to observe file system stuff 
> during launch - if anyone knows, please let me know!

Instruments/DTrace?

--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: NSFileManager - a cautionary tale

2011-07-26 Thread Graham Cox

On 27/07/2011, at 11:14 AM, Graham Cox wrote:

> This call to mkdir causes the App Store reviewers to have conniptions, even 
> though it certainly fails.


Another thing to mention - we run this code during app launch, so we didn't see 
it in fs_usage, which requires that the process it's peeking at is running 
already. I'm not sure if there is a way to observe file system stuff during 
launch - if anyone knows, please let me know!

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: How can i change a app position and size?

2011-07-26 Thread Diego Alvarez Nogueira
Sorry, i am new in cocoa, i've searched a lot about how can i do this.
I'm capturing the bounds in this way:
===
CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionAll, 
kCGNullWindowID);

for (NSMutableDictionary* entry in (NSArray*) windowList) {
  NSString *appPID  = [entry objectForKey:(id)kCGWindowOwnerPID];
  NSString *appName = [entry objectForKey:(id)kCGWindowOwnerName];
  NSString *appWorkSpace= [entry objectForKey:(id)kCGWindowWorkspace];
  NSString *appWindowID = [entry objectForKey:(id)kCGWindowNumber];
  
  CGRect bounds;
  CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[entry 
objectForKey:(id)kCGWindowBounds], &bounds);

  NSString *originString = [NSString stringWithFormat:@"%.0f/%.0f", 
bounds.origin.x, bounds.origin.y];
  [entry setObject:originString forKey:@"windowOrigin"];

  NSString *sizeString = [NSString stringWithFormat:@"%.0f*%.0f", 
bounds.size.width, bounds.size.height];
  [entry setObject:sizeString forKey:@"windowSize"];
}


1)Why do I have some differences in get bounds between cocoa and applescript? 
for instance: on 'originString' and 'sizeString' are 
returned({1920,106,1280,800}) and with applescript ("set _bounds to get bounds 
of window window_number") are returned ({1920, 106, 3200, 906}).

2) How can i apply this bounds with cocoa? for instance, move and resize my 
safari and terminal application.

Thanks a lot!

Best,
Diego Nogueira


On 26/07/2011, at 06:28, Bill Cheeseman wrote:

> 
> On Jul 26, 2011, at 1:02 AM, Jens Alfke wrote:
> 
>> On Jul 24, 2011, at 4:14 PM, Diego Alvarez Nogueira wrote:
>> 
>>> How can i change a app position and size by Pid number?
>> 
>> You mean resizing other apps’ windows? I think the only option is using UI 
>> Scripting, where you can send an app AppleEvents that generate fake user 
>> input events like clicks and drags. Look it up in the developer 
>> documentation.
> 
> 
> Or use Apple's accessibility API directly. GUI Scripting is built on top of 
> the accessibility API.
> 
> -- 
> 
> 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/diegoalvareznogueira%40gmail.com
> 
> This email sent to diegoalvareznogue...@gmail.com



--
Atenciosamente,

Diego Alvarez Nogueira
Blog: http://diegonogueira.com.br | http://papoinformal.com
Skype: nogueiradiego
Twitter: @nogueiradiego

___

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


NSFileManager - a cautionary tale

2011-07-26 Thread Graham Cox
Hi all, this is just a FYI really.

We've had a difficult job getting our latest app update through the App Store 
review, failing under section 2.3.0 which claims the we were writing to a 
location within the application's bundle.

The culprit turns out to be [NSFileManager 
createDirectoryAtPath:withIntermediateDirectories:attributes:error:]. The docs 
state this returns YES if the directories were created successfully, OR IF THEY 
EXIST ALREADY. We were relying on this second part for reading files from 
within the app's bundle to continue (the same code runs for both files read 
internally from the bundle and from an external location). However, this method 
eventually calls mkdir, which fails with an error if the directory already 
exists. This call to mkdir causes the App Store reviewers to have conniptions, 
even though it certainly fails. The failure of mkdir is interpreted by 
NSFileManager as a success (i.e. the method apparently works by attempting the 
mkdir, rather than checking for its existence beforehand).

While the fix is easy, understanding the problem was pretty difficult. So 
basically, beware this method if you use it like I was, expecting it to be safe 
to use on your app's bundle. You won't get past review.

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: 1. Creating a TCP server? (Rick Mann)

2011-07-26 Thread Rick Mann
Oh, that looks promising, thanks!

On Jul 26, 2011, at 16:20 , John MacMullin wrote:

> http://developer.apple.com/library/mac/#samplecode/CocoaEcho/Introduction/Intro.html
>  ?
> 
> On Jul 26, 2011, at 2:42 PM, cocoa-dev-requ...@lists.apple.com wrote:
> 
>> Send Cocoa-dev mailing list submissions to
>>  cocoa-dev@lists.apple.com
>> 
>> To subscribe or unsubscribe via the World Wide Web, visit
>>  http://lists.apple.com/mailman/listinfo/cocoa-dev
>> or, via email, send a message with subject or body 'help' to
>>  cocoa-dev-requ...@lists.apple.com
>> 
>> You can reach the person managing the list at
>>  cocoa-dev-ow...@lists.apple.com
>> 
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of Cocoa-dev digest..."
>> 
>> 
>> Today's Topics:
>> 
>>  1. Creating a TCP server? (Rick Mann)
>>  2. Re: Creating a TCP server? (Eric Gorr)
>>  3. Re: App won't get to my code in Lion (Greg Parker)
>>  4. Toggle an object (image) when Command key is pressed:
>> flagsChanged? (Patrick Robertson)
>>  5. Re: Creating a TCP server? (Bing Li)
>>  6. Re: Creating a TCP server? (Rick Mann)
>>  7. Re: Toggle an object (image) when Command key is pressed:
>> flagsChanged? (Quincey Morris)
>>  8. Re: Creating a TCP server? (davel...@mac.com)
>>  9. Re: App won't get to my code in Lion (Charles Srstka)
>> 10. Re: Toggle an object (image) when Command key is pressed:
>> flagsChanged? (Kyle Sluder)
>> 11. Re: Creating a TCP server? (Tito Ciuro)
>> 12. Re: Creating a TCP server? (Eric Gorr)
>> 13. Re: Dialog Command Keys (Gregory Weston)
>> 
>> 
>> --
>> 
>> Message: 1
>> Date: Tue, 26 Jul 2011 12:17:10 -0700
>> From: Rick Mann 
>> Subject: Creating a TCP server?
>> To: Cocoa Developer 
>> Message-ID: <07b5303b-f9f7-4424-9047-9e11f0701...@latencyzero.com>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> Hi. I need to build a little serial port-to-TCP server (so that clients can 
>> connect to my Mac to interact with a serial port). Among other things, I 
>> want to advertise this using Bonjour.
>> 
>> How do I create a TCP server in Cocoa? It seems like CF networking is my 
>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at 
>> NSSocket and NSStream, but they're not really what I want, I think.
>> 
>> And to verify: is NSNetServices what I need to publish the Bonjour name? 
>> 
>> Thanks.
>> 
>> -- 
>> Rick
>> 
>> 
>> 
>> --
>> 
>> Message: 2
>> Date: Tue, 26 Jul 2011 15:23:21 -0400
>> From: Eric Gorr 
>> Subject: Re: Creating a TCP server?
>> To: Rick Mann 
>> Cc: Cocoa Developer 
>> Message-ID: <9d1d9f0c-5593-4277-b4c8-3fec85db6...@ericgorr.net>
>> Content-Type: text/plain; charset=us-ascii
>> 
>> I would suggest checking out the SSD sample project from WWDC 2010. There 
>> are a couple of problems in the source which are covered in this thread:
>> 
>> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg5.html
>> 
>> But the basics of what you want to do I believe are there...
>> 
>> 
>> On Jul 26, 2011, at 3:17 PM, Rick Mann  wrote:
>> 
>>> Hi. I need to build a little serial port-to-TCP server (so that clients can 
>>> connect to my Mac to interact with a serial port). Among other things, I 
>>> want to advertise this using Bonjour.
>>> 
>>> How do I create a TCP server in Cocoa? It seems like CF networking is my 
>>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at 
>>> NSSocket and NSStream, but they're not really what I want, I think.
>>> 
>>> And to verify: is NSNetServices what I need to publish the Bonjour name? 
>>> 
>>> Thanks.
>>> 
>>> -- 
>>> Rick
>>> 
>>> ___
>>> 
>>> 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/mailist%40ericgorr.net
>>> 
>>> This email sent to mail...@ericgorr.net
>> 
>> 
>> --
>> 
>> Message: 3
>> Date: Tue, 26 Jul 2011 12:48:56 -0700
>> From: Greg Parker 
>> Subject: Re: App won't get to my code in Lion
>> To: John Nairn 
>> Cc: cocoa-dev@lists.apple.com
>> Message-ID: 
>> Content-Type: text/plain; charset=windows-1252
>> 
>> On Jul 26, 2011, at 10:34 AM, John Nairn wrote:
>>> I was trying to get away with XCode 3.25 on Lion to make a quick fix to my 
>>> code. I have now installed Xcode 4.1. So far I am getting the same error 
>>> message. I had this once before in a different application and the solution 
>>> then was to create a completely new project and manually add all files back 
>>> in. I will try that soon, but this is a big project and that is not an easy 
>>> task. I was hoping the issue was similar.
>>> 
>>> Are the LC_VERSION_MIN_MACOSX 

Re: Creating a TCP server?

2011-07-26 Thread Rick Mann
I think that's what I want to use!

On Jul 26, 2011, at 16:40 , vade wrote:

> I would highly suggest looking at AsyncSocket. I've personally used it a few 
> times and its been a pleasure to work with. 
> 
> http://code.google.com/p/cocoaasyncsocket/
> 
> 
> 
> 
> On Jul 26, 2011, at 3:17 PM, Rick Mann wrote:
> 
>> Hi. I need to build a little serial port-to-TCP server (so that clients can 
>> connect to my Mac to interact with a serial port). Among other things, I 
>> want to advertise this using Bonjour.
>> 
>> How do I create a TCP server in Cocoa? It seems like CF networking is my 
>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at 
>> NSSocket and NSStream, but they're not really what I want, I think.
>> 
>> And to verify: is NSNetServices what I need to publish the Bonjour name? 
>> 
>> Thanks.
>> 
>> -- 
>> Rick
>> 
>> ___
>> 
>> 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/vade%40vade.info
>> 
>> This email sent to v...@vade.info
> 

___

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: NSTask oddity with getting stdout

2011-07-26 Thread Shane Stanley
On 27/7/11 3:18 AM, "Scott Ribe"  wrote:

> Maybe you should try to re-open your bug ;-)

I did, but no reply.

Here's some code that's reading a file that's being written periodically:

-(void)dataFromFile:(NSNotification *)notif {
NSData *data = [[notif userInfo]
objectForKey:NSFileHandleNotificationDataItem];
if ([data length]) {
 // do stuff
   }   
   [[notif object] readInBackgroundAndNotify]; // call again
}

In Snow Leopard that worked fine; a notification would be sent when new data
was written to the file. In Lion, as soon as it's called it goes into a
loop; each time readInBackgroundAndNotify is sent, a new notification comes
straight back.


-- 
Shane Stanley 
'AppleScriptObjC Explored' 


___

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: Creating a TCP server?

2011-07-26 Thread vade
I would highly suggest looking at AsyncSocket. I've personally used it a few 
times and its been a pleasure to work with. 

http://code.google.com/p/cocoaasyncsocket/




On Jul 26, 2011, at 3:17 PM, Rick Mann wrote:

> Hi. I need to build a little serial port-to-TCP server (so that clients can 
> connect to my Mac to interact with a serial port). Among other things, I want 
> to advertise this using Bonjour.
> 
> How do I create a TCP server in Cocoa? It seems like CF networking is my best 
> bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket 
> and NSStream, but they're not really what I want, I think.
> 
> And to verify: is NSNetServices what I need to publish the Bonjour name? 
> 
> Thanks.
> 
> -- 
> Rick
> 
> ___
> 
> 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/vade%40vade.info
> 
> This email sent to v...@vade.info

___

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


1. Creating a TCP server? (Rick Mann)

2011-07-26 Thread John MacMullin
http://developer.apple.com/library/mac/#samplecode/CocoaEcho/Introduction/Intro.html
 ?

On Jul 26, 2011, at 2:42 PM, cocoa-dev-requ...@lists.apple.com wrote:

> Send Cocoa-dev mailing list submissions to
>   cocoa-dev@lists.apple.com
> 
> To subscribe or unsubscribe via the World Wide Web, visit
>   http://lists.apple.com/mailman/listinfo/cocoa-dev
> or, via email, send a message with subject or body 'help' to
>   cocoa-dev-requ...@lists.apple.com
> 
> You can reach the person managing the list at
>   cocoa-dev-ow...@lists.apple.com
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cocoa-dev digest..."
> 
> 
> Today's Topics:
> 
>   1. Creating a TCP server? (Rick Mann)
>   2. Re: Creating a TCP server? (Eric Gorr)
>   3. Re: App won't get to my code in Lion (Greg Parker)
>   4. Toggle an object (image) when Command key is pressed:
>  flagsChanged? (Patrick Robertson)
>   5. Re: Creating a TCP server? (Bing Li)
>   6. Re: Creating a TCP server? (Rick Mann)
>   7. Re: Toggle an object (image) when Command key is pressed:
>  flagsChanged? (Quincey Morris)
>   8. Re: Creating a TCP server? (davel...@mac.com)
>   9. Re: App won't get to my code in Lion (Charles Srstka)
>  10. Re: Toggle an object (image) when Command key is pressed:
>  flagsChanged? (Kyle Sluder)
>  11. Re: Creating a TCP server? (Tito Ciuro)
>  12. Re: Creating a TCP server? (Eric Gorr)
>  13. Re: Dialog Command Keys (Gregory Weston)
> 
> 
> --
> 
> Message: 1
> Date: Tue, 26 Jul 2011 12:17:10 -0700
> From: Rick Mann 
> Subject: Creating a TCP server?
> To: Cocoa Developer 
> Message-ID: <07b5303b-f9f7-4424-9047-9e11f0701...@latencyzero.com>
> Content-Type: text/plain; charset=us-ascii
> 
> Hi. I need to build a little serial port-to-TCP server (so that clients can 
> connect to my Mac to interact with a serial port). Among other things, I want 
> to advertise this using Bonjour.
> 
> How do I create a TCP server in Cocoa? It seems like CF networking is my best 
> bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket 
> and NSStream, but they're not really what I want, I think.
> 
> And to verify: is NSNetServices what I need to publish the Bonjour name? 
> 
> Thanks.
> 
> -- 
> Rick
> 
> 
> 
> --
> 
> Message: 2
> Date: Tue, 26 Jul 2011 15:23:21 -0400
> From: Eric Gorr 
> Subject: Re: Creating a TCP server?
> To: Rick Mann 
> Cc: Cocoa Developer 
> Message-ID: <9d1d9f0c-5593-4277-b4c8-3fec85db6...@ericgorr.net>
> Content-Type: text/plain; charset=us-ascii
> 
> I would suggest checking out the SSD sample project from WWDC 2010. There are 
> a couple of problems in the source which are covered in this thread:
> 
> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg5.html
> 
> But the basics of what you want to do I believe are there...
> 
> 
> On Jul 26, 2011, at 3:17 PM, Rick Mann  wrote:
> 
>> Hi. I need to build a little serial port-to-TCP server (so that clients can 
>> connect to my Mac to interact with a serial port). Among other things, I 
>> want to advertise this using Bonjour.
>> 
>> How do I create a TCP server in Cocoa? It seems like CF networking is my 
>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at 
>> NSSocket and NSStream, but they're not really what I want, I think.
>> 
>> And to verify: is NSNetServices what I need to publish the Bonjour name? 
>> 
>> Thanks.
>> 
>> -- 
>> Rick
>> 
>> ___
>> 
>> 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/mailist%40ericgorr.net
>> 
>> This email sent to mail...@ericgorr.net
> 
> 
> --
> 
> Message: 3
> Date: Tue, 26 Jul 2011 12:48:56 -0700
> From: Greg Parker 
> Subject: Re: App won't get to my code in Lion
> To: John Nairn 
> Cc: cocoa-dev@lists.apple.com
> Message-ID: 
> Content-Type: text/plain; charset=windows-1252
> 
> On Jul 26, 2011, at 10:34 AM, John Nairn wrote:
>> I was trying to get away with XCode 3.25 on Lion to make a quick fix to my 
>> code. I have now installed Xcode 4.1. So far I am getting the same error 
>> message. I had this once before in a different application and the solution 
>> then was to create a completely new project and manually add all files back 
>> in. I will try that soon, but this is a big project and that is not an easy 
>> task. I was hoping the issue was similar.
>> 
>> Are the LC_VERSION_MIN_MACOSX and LC_FUNCTION_STARTS translations of 0x24 
>> and 0x26. I had been trying to target 10.5 and deploy to 10.4. That could 
>> not find the SDK in Xcode 4.1. I switched target to 10.6 (which builds, but 
>> l

Re: Receiving unicode keyboard input

2011-07-26 Thread Aki Inoue
Bill,

You cannot directly access the Cocoa text handling method inside the NPAPI 
plugins.

Instead the NPAPI's Cocoa extension defines the composition handling logic by 
itself.

Refer to the 'Text Input' section in this document 
.

Aki

On 2011/07/23, at 8:59, Bill Appleton wrote:

> Hi All,
> 
> For an NPAPI plugin we need to receive Unicode keyboard input. We are
> calling interpretKeyEvents and receiving the insertText message, but if I
> type option-e (for example) we are not getting the accented-e character.
> 
> Can anyone shed some light on the right way to get unicode characters?
> Unfortunately we cannot use all the core Text stuff because (as mentioned)
> this is an NPAPI plugin and we don't even have access to the output view or
> window.
> 
> 
> Best,
> 
> Bill Appleton
> ___
> 
> 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/aki%40apple.com
> 
> This email sent to a...@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


Re: Dialog Command Keys

2011-07-26 Thread Bill Appleton
hi greg, this application is the dreamfactory player, this is a stand-alone
development environment and also a NPAPI plugin for chrome, safari and
firefox.
there are huge limitations for npapi, for example, we only get a core
graphics surface to draw the app on not an nsview or an nswindow
the code base must work on windows and mac and this is half a million lines
of c and in order to have portability the dialogs are built out of a
platform independent xml description
but we are always looking for a better way and we probably could use
interface builder more

however the problem i am having is with all dialogs, even cocoa get file and
put file dialogs that are not dynamically built







On Tue, Jul 26, 2011 at 2:38 PM, Gregory Weston  wrote:

> Bill Appleton wrote:
>
> > Based on my app, the dialog boxes have to be created dynamically, so i
> can't
> > use Interface Builder, so they are assembled out of cocoa controls as
> > needed.
> >
> > My dialogs beep when i control-x to cut some selected text
> >
> > What is the simple way for my dialog window to pass these command keys
> > events down to the text views?
> >
> > Thanks in advance
>
> Not to be impertinent but through this thread I'm wondering if the OP is
> putting himself through this pain unnecessarily. There *are* certainly
> legitimate reasons to be building parts of your UI at runtime but in my
> experience it's vanishingly rare, especially for the entire application. Is
> this one of those scenarios where the most beneficial answer to "How do I do
> X" is "Don't?"
>
> So to Bill: What's the situation for your app that you've decided requires
> you to build everything at runtime? *Why* can't you use IB?
>
> Greg
> ___
>
> 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/billappleton%40dreamfactory.com
>
> This email sent to billapple...@dreamfactory.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: Dialog Command Keys

2011-07-26 Thread Gregory Weston
Bill Appleton wrote:

> Based on my app, the dialog boxes have to be created dynamically, so i can't
> use Interface Builder, so they are assembled out of cocoa controls as
> needed.
> 
> My dialogs beep when i control-x to cut some selected text
> 
> What is the simple way for my dialog window to pass these command keys
> events down to the text views?
> 
> Thanks in advance

Not to be impertinent but through this thread I'm wondering if the OP is 
putting himself through this pain unnecessarily. There *are* certainly 
legitimate reasons to be building parts of your UI at runtime but in my 
experience it's vanishingly rare, especially for the entire application. Is 
this one of those scenarios where the most beneficial answer to "How do I do X" 
is "Don't?"

So to Bill: What's the situation for your app that you've decided requires you 
to build everything at runtime? *Why* can't you use IB?

Greg
___

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: Creating a TCP server?

2011-07-26 Thread Eric Gorr
What, I think distinguishes the SSD example from others is that it uses the two 
most modern methods to get the job done - launchd and GCD.



On Jul 26, 2011, at 4:31 PM, Rick Mann  wrote:

> Thanks, I saw those messages going by. I'll take a look.
> 
> -- 
> Rick
> 
> On Jul 26, 2011, at 12:23 , Eric Gorr wrote:
> 
>> I would suggest checking out the SSD sample project from WWDC 2010. There 
>> are a couple of problems in the source which are covered in this thread:
>> 
>> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg5.html
>> 
>> But the basics of what you want to do I believe are there...
>> 
>> 
>> On Jul 26, 2011, at 3:17 PM, Rick Mann  wrote:
>> 
>>> Hi. I need to build a little serial port-to-TCP server (so that clients can 
>>> connect to my Mac to interact with a serial port). Among other things, I 
>>> want to advertise this using Bonjour.
>>> 
>>> How do I create a TCP server in Cocoa? It seems like CF networking is my 
>>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at 
>>> NSSocket and NSStream, but they're not really what I want, I think.
>>> 
>>> And to verify: is NSNetServices what I need to publish the Bonjour name? 
>>> 
>>> Thanks.
>>> 
>>> -- 
>>> Rick
>>> 
>>> ___
>>> 
>>> 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/mailist%40ericgorr.net
>>> 
>>> This email sent to mail...@ericgorr.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: Creating a TCP server?

2011-07-26 Thread Tito Ciuro
Hello,

More options:

A simple, extensible HTTP server in Cocoa
http://cocoawithlove.com/2009/07/simple-extensible-http-server-in-cocoa.html

How to Write a Cocoa Web Server
http://macdevcenter.com/pub/a/mac/2006/11/14/how-to-write-a-cocoa-web-server.html

A Simple HTTP Server
http://culturedcode.com/cocoa/

-- Tito

On Jul 26, 2011, at 5:38 PM, davel...@mac.com wrote:

> Here's some sample code (I'm not the author)
> 
> https://bitbucket.org/snej/mynetwork/overview
> 
> Dave
> 
> 
> On Jul 26, 2011, at 4:00 PM, Bing Li wrote:
> 
>> Hi, Rick,
>> 
>> If you are familiar with BSD socket, you can program with it to create a TCP
>> server. I have done that successfully.
>> 
>> Thanks,
>> Bing
>> 
>> On Wed, Jul 27, 2011 at 3:17 AM, Rick Mann  wrote:
>> 
>>> Hi. I need to build a little serial port-to-TCP server (so that clients can
>>> connect to my Mac to interact with a serial port). Among other things, I
>>> want to advertise this using Bonjour.
>>> 
>>> How do I create a TCP server in Cocoa? It seems like CF networking is my
>>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at
>>> NSSocket and NSStream, but they're not really what I want, I think.
>>> 
>>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>>> 
>>> Thanks.
>>> 
>>> --
>>> Rick
> ___
> 
> 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/tciuro%40mac.com
> 
> This email sent to tci...@mac.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: Toggle an object (image) when Command key is pressed: flagsChanged?

2011-07-26 Thread Kyle Sluder
On Tue, Jul 26, 2011 at 12:50 PM, Patrick Robertson
 wrote:
> First, you can see from the code that I can't seem to find a mask for when
> 'no' modifier keys are pressed. This method does get called for key downs
> and key ups. It seems 'no keys' corresponds to 0x100, but is there no
> constant I can use?

Did you remember to AND the modifierFlags with
NSDeviceIndependentModifierFlagsMask?

>
> Secondly, this method seems to get called when other key combos are pressed
> (e.g. ⌘S or ⌘Q). This means the object/image will flick back/forward, which
> isn't entirely desirable.

In either 10.5 or 10.6, Apple changed the implementation of NSToolbar
to avoid this flickering by delaying for a fraction of a second before
changing its image in response to a -flagsChanged: event. Check the
AppKit release notes for more info.

--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: App won't get to my code in Lion

2011-07-26 Thread Charles Srstka
On Jul 26, 2011, at 12:19 AM, John Nairn wrote:

> My app won't start at all in Lion. I always thought the first code will be in
> 
> - (void)applicationWillFinishLaunching:(NSNotification *)aNotification
> 
> but that code is never reached. So I am a loss of how to fix it.
> 
> Many of my users claim they can get it running by deleting the folder 
> ~/Library/Icons but other users claim that does not help?

This may be a silly question, but are you sure that your object is set as 
NSApplication’s delegate in the nib file?

Charles___

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: Creating a TCP server?

2011-07-26 Thread davelist
Here's some sample code (I'm not the author)

https://bitbucket.org/snej/mynetwork/overview

Dave


On Jul 26, 2011, at 4:00 PM, Bing Li wrote:

> Hi, Rick,
> 
> If you are familiar with BSD socket, you can program with it to create a TCP
> server. I have done that successfully.
> 
> Thanks,
> Bing
> 
> On Wed, Jul 27, 2011 at 3:17 AM, Rick Mann  wrote:
> 
>> Hi. I need to build a little serial port-to-TCP server (so that clients can
>> connect to my Mac to interact with a serial port). Among other things, I
>> want to advertise this using Bonjour.
>> 
>> How do I create a TCP server in Cocoa? It seems like CF networking is my
>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at
>> NSSocket and NSStream, but they're not really what I want, I think.
>> 
>> And to verify: is NSNetServices what I need to publish the Bonjour name?
>> 
>> Thanks.
>> 
>> --
>> Rick
___

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: Toggle an object (image) when Command key is pressed: flagsChanged?

2011-07-26 Thread Quincey Morris

On Jul 26, 2011, at 12:50, Patrick Robertson wrote:

> First, you can see from the code that I can't seem to find a mask for when
> 'no' modifier keys are pressed. This method does get called for key downs
> and key ups. It seems 'no keys' corresponds to 0x100, but is there no
> constant I can use?

Yes, use the constant 0. Or how about "else"?

if ([theEvent modifierFlags] & NSCommandKeyMask)
...
else //  use this ...
...

if (([theEvent modifierFlags] & NSCommandKeyMask) == 0) // ... or this 
...
...

if (!([theEvent modifierFlags] & NSCommandKeyMask)) // ... or this
...

I'll also point out that you don't want "'no' modifier keys", you want no 
*Command* modifier key. Or do you really mean "'no' modifier keys"?

> Secondly, this method seems to get called when other key combos are pressed
> (e.g. ⌘S or ⌘Q). This means the object/image will flick back/forward, which
> isn't entirely desirable.

Well, of course. You're choosing to use a *modifier* key, which gets pressed 
first (and sometimes first by quite a long time), and that modifier is already 
used for other things too. That means it's not highly desirable to use the 
Command key for modes that are slow to switch or are extremely visible to the 
user.

If must use Command, you could certainly try delaying the switch in state, but 
that of course makes it seem less responsive.


___

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: Creating a TCP server?

2011-07-26 Thread Rick Mann
Thanks, I saw those messages going by. I'll take a look.

-- 
Rick

On Jul 26, 2011, at 12:23 , Eric Gorr wrote:

> I would suggest checking out the SSD sample project from WWDC 2010. There are 
> a couple of problems in the source which are covered in this thread:
> 
> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg5.html
> 
> But the basics of what you want to do I believe are there...
> 
> 
> On Jul 26, 2011, at 3:17 PM, Rick Mann  wrote:
> 
>> Hi. I need to build a little serial port-to-TCP server (so that clients can 
>> connect to my Mac to interact with a serial port). Among other things, I 
>> want to advertise this using Bonjour.
>> 
>> How do I create a TCP server in Cocoa? It seems like CF networking is my 
>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at 
>> NSSocket and NSStream, but they're not really what I want, I think.
>> 
>> And to verify: is NSNetServices what I need to publish the Bonjour name? 
>> 
>> Thanks.
>> 
>> -- 
>> Rick
>> 
>> ___
>> 
>> 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/mailist%40ericgorr.net
>> 
>> This email sent to mail...@ericgorr.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: Creating a TCP server?

2011-07-26 Thread Bing Li
Hi, Rick,

If you are familiar with BSD socket, you can program with it to create a TCP
server. I have done that successfully.

Thanks,
Bing

On Wed, Jul 27, 2011 at 3:17 AM, Rick Mann  wrote:

> Hi. I need to build a little serial port-to-TCP server (so that clients can
> connect to my Mac to interact with a serial port). Among other things, I
> want to advertise this using Bonjour.
>
> How do I create a TCP server in Cocoa? It seems like CF networking is my
> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at
> NSSocket and NSStream, but they're not really what I want, I think.
>
> And to verify: is NSNetServices what I need to publish the Bonjour name?
>
> Thanks.
>
> --
> Rick
>
> ___
>
> 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/lblabs%40gmail.com
>
> This email sent to lbl...@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


Toggle an object (image) when Command key is pressed: flagsChanged?

2011-07-26 Thread Patrick Robertson
Hi all,

I'm wanting to toggle an object between its default and 'alternate' state
(the object is made up of an image and some text) when the user hits the
command (⌘) key. An obvious example is in Xcode 3.2 where if you press ⌥ the
'Build and Run' icon and text changes to 'Build and Debug' (or vice versa,
depending on your breakpoints)

The object is in a custom view which is a sub (sub) class of NSControl →
NSView etc. etc.

I assumed I'd be able to use

- (void)flagsChanged:(NSEvent *)theEvent {

if ([theEvent modifierFlags] &NSCommandKeyMask) {

// change the image

}

// when keys are lifted so there are no modifiers

if ([theEvent modifierFlags] & **NSNoKeys**) {

// set the image back to the original

}

}


but have come across a few problems.

First, you can see from the code that I can't seem to find a mask for when
'no' modifier keys are pressed. This method does get called for key downs
and key ups. It seems 'no keys' corresponds to 0x100, but is there no
constant I can use?

Secondly, this method seems to get called when other key combos are pressed
(e.g. ⌘S or ⌘Q). This means the object/image will flick back/forward, which
isn't entirely desirable.

Any suggestions would be greatly appreciated.

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: App won't get to my code in Lion

2011-07-26 Thread Greg Parker
On Jul 26, 2011, at 10:34 AM, John Nairn wrote:
> I was trying to get away with XCode 3.25 on Lion to make a quick fix to my 
> code. I have now installed Xcode 4.1. So far I am getting the same error 
> message. I had this once before in a different application and the solution 
> then was to create a completely new project and manually add all files back 
> in. I will try that soon, but this is a big project and that is not an easy 
> task. I was hoping the issue was similar.
> 
> Are the LC_VERSION_MIN_MACOSX and LC_FUNCTION_STARTS translations of 0x24 and 
> 0x26. I had been trying to target 10.5 and deploy to 10.4. That could not 
> find the SDK in Xcode 4.1. I switched target to 10.6 (which builds, but lots 
> of warnings) and left deploy at 10.4. I will try changing some more (but I am 
> away from my development Mac until tonight)

"unable to read unknown load command" is reported by the debugger. The Xcode 
3.x debugger is unaware of Lion's new load commands.

Those messages should be harmless. The debugger should be able to run and debug 
your app successfully even without understanding those load commands.

You need to figure out where the app is stuck. Run it, click Pause, and look at 
the backtraces of all threads.


-- 
Greg Parker gpar...@apple.com  Runtime Wrangler


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Creating a TCP server?

2011-07-26 Thread Eric Gorr
I would suggest checking out the SSD sample project from WWDC 2010. There are a 
couple of problems in the source which are covered in this thread:

http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg5.html

But the basics of what you want to do I believe are there...


On Jul 26, 2011, at 3:17 PM, Rick Mann  wrote:

> Hi. I need to build a little serial port-to-TCP server (so that clients can 
> connect to my Mac to interact with a serial port). Among other things, I want 
> to advertise this using Bonjour.
> 
> How do I create a TCP server in Cocoa? It seems like CF networking is my best 
> bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket 
> and NSStream, but they're not really what I want, I think.
> 
> And to verify: is NSNetServices what I need to publish the Bonjour name? 
> 
> Thanks.
> 
> -- 
> Rick
> 
> ___
> 
> 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/mailist%40ericgorr.net
> 
> This email sent to mail...@ericgorr.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


Creating a TCP server?

2011-07-26 Thread Rick Mann
Hi. I need to build a little serial port-to-TCP server (so that clients can 
connect to my Mac to interact with a serial port). Among other things, I want 
to advertise this using Bonjour.

How do I create a TCP server in Cocoa? It seems like CF networking is my best 
bet, but I thought TCP should be easy via Cocoa. I briefly looked at NSSocket 
and NSStream, but they're not really what I want, I think.

And to verify: is NSNetServices what I need to publish the Bonjour name? 

Thanks.

-- 
Rick

___

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: How to implement Autosaving, Browsing Versions, Reverting to Last Saved in Lion?

2011-07-26 Thread Kevin Perry
There is nothing that you are obviously doing wrong here. Please file a Radar 
with your test app attached.

-KP

On Jul 24, 2011, at 7:46 PM, Zorg wrote:

> I'm having a difficult time figuring out how to implement these features 
> correctly in Lion. I've created a very simple NSDocument based test app: 
> http://pastebin.com/w396Xxi4
> 
> A document in this test app has a window and a text field, the user enters 
> text in the text field, that text is the "state" of the document. The app 
> saves and loads that text.
> 
> I'm saving the data using dataOfType: error: and loading the data using 
> readFromData: ofType: error:. The user interface (the text field in 
> particular) is being updated after being loaded in 
> windowControllerDidLoadNib: unless the data is being reverted, in which 
> instead the user interface is being updated in readFromData: ofType: error: 
> (to test if a document is being reverted, I check if an outlet such as the 
> textField != nil)
> 
> Now, the saving of the document works fine. Browsing and choosing a different 
> saved version of the document also works fine. What doesn't work correctly is 
> reverting to another version. For example, if I create a new document, save 
> the document, make a change (entering something new in the text field and 
> hitting enter), choose revert to last saved version from the window titlebar, 
> and save again, I occasionally get an error message "This document's file has 
> been changed by another application since you opened or saved it." or I get 
> "The location of the document - cannot be determined." (I say 
> occasionally because I cannot get it to error the first attempt I do this 
> while a document is still open, but usually always get an error on my second, 
> and further attempts). I can also reproduce this error when trying to save 
> after choosing a different version in the versions browser, however, I think 
> I can only reproduce the error in this case when my document is in an edited 
> state before trying to choose another version (If I save before trying to 
> choose a different version and then save after, I don't get get an error).
> 
> Here's a couple images of the errors:
> http://dl.dropbox.com/u/10108199/error1.png
> http://dl.dropbox.com/u/10108199/error2.png
> 
> Also, is there a better approach to loading a reverted document than what I'm 
> doing (instead of testing if an outlet of a document is nil)? Any help would 
> be appreciated.
> 
> Thanks,
> -Zorg:-.___
> 
> 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/kperry%40apple.com
> 
> This email sent to kpe...@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


Re: [SOLVED] Problem getting my layers to draw in the right order

2011-07-26 Thread Kyle Sluder
On Tue, Jul 26, 2011 at 10:51 AM, David Duncan  wrote:
> Except for certain situations, Core Animation effectively treats each layer 
> as a rendering target – that is, all of that layer's sublayers are flattened 
> into that layer  to produce the final image for that layer. What this means 
> is that only local sibling ordering matters at any given level of the layer 
> tree. Graphically that means if you have this:
>
> X
> |  \
> Y Z
> |
> W
>
> W can never render on top of Z, because W always renders "into" Y, and Z 
> always renders on top of Y.

Okay, I misinterpreted your comment in that other thread.

> This is basically what you have with a CALayer already (zPosition should be 
> usable as a way to order layers, but sublayer order is generally better). If 
> you use a CATransformLayer, or a CAReplicatorLayer with preservesDepth=YES 
> then you are effectively asking Core Animation to act more like a textured 
> quad renderer. See the CATransformLayer documentation for details on the 
> restrictions that come with that.

It sounds like an explicit render target would still be a handy thing
to have, though, for cases where you'd want to render a bunch of quads
into a billboard.

--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: [SOLVED] Problem getting my layers to draw in the right order

2011-07-26 Thread David Duncan
On Jul 26, 2011, at 7:50 AM, Kyle Sluder wrote:

> From the description given in the documentation, I would think that because 
> CA is sorting the layers based on sibling order and zPosition that it would 
> be possible to render a layer of zPosition=0 atop a nephew layer with 
> zPosition=1000.
> 
> But I can see why this would be difficult: Core Animation apparently applies 
> the zPosition to the layer's GL quad. In order to support rendering 
> zPosition=0 atop zPosition=1000, it would need to maintain a copy of the 
> depth buffer at each level of the layer. Rendering a layer would involve a 
> depth test, then copying the depth buffer to be used when rendering the 
> sublayers and discarding that depth buffer when done.

Except for certain situations, Core Animation effectively treats each layer as 
a rendering target – that is, all of that layer's sublayers are flattened into 
that layer  to produce the final image for that layer. What this means is that 
only local sibling ordering matters at any given level of the layer tree. 
Graphically that means if you have this:

X
|  \
Y Z
|
W

W can never render on top of Z, because W always renders "into" Y, and Z always 
renders on top of Y.

Sibling drawing order is more complicated in the presence of certain types of 
transforms, such as perspective transforms and rotations around X/Y because 
these transforms make a layer's geometry more complex. To render these 
properly, Core Animation will cut a layer's rendered image properly to match 
expectations for that geometry.

> This is a place where the abstraction leaks. I think the documentation should 
> be updated to make it clearer that zPosition can't be used for general Quartz 
> Transparency Layer type effects, which it seems to imply. We should also 
> probably get a CALayerGroup layer class that *does* render all of its 
> sublayers into a quad whose z position is equal to that of the CALayerGroup's 
> zPosition property.


This is basically what you have with a CALayer already (zPosition should be 
usable as a way to order layers, but sublayer order is generally better). If 
you use a CATransformLayer, or a CAReplicatorLayer with preservesDepth=YES then 
you are effectively asking Core Animation to act more like a textured quad 
renderer. See the CATransformLayer documentation for details on the 
restrictions that come with that.
--
David Duncan

___

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: Dialog Command Keys

2011-07-26 Thread Kyle Sluder
On Tue, Jul 26, 2011 at 10:30 AM, Bill Appleton
 wrote:
> hi all
>
> i set the target and the action on my menu items -- this is so that i can
> get my handler called when someone selects a menu item
> i will re-read the event handler docs with regard to menu items (no keyboard
> issues) and see if that helps

Ah, there's your problem. You need to set these targets to nil, which
is equivalent to wiring them up to First Responder in a nib.

--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: Dialog Command Keys

2011-07-26 Thread Joar Wingfors

On 26 jul 2011, at 10:30, Bill Appleton wrote:

> i set the target and the action on my menu items -- this is so that i can get 
> my handler called when someone selects a menu item
> i will re-read the event handler docs with regard to menu items (no keyboard 
> issues) and see if that helps


You typically can't (or at least shouldn't) set a concrete, ie. non-nil, target 
for menu items that may serve different parts of the UI at different times - 
Like Cut / Copy / Paste. You may ask: If I don't set a target, how will the 
menu item find a receiver for its action? Well, that's a service provided by 
the responder chain. One of the core concepts of UI programming on the Mac, so 
hone in on that when you're reading up on t his.

Cheers,

j o a r


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: App won't get to my code in Lion

2011-07-26 Thread John Nairn
I was trying to get away with XCode 3.25 on Lion to make a quick fix to my 
code. I have now installed Xcode 4.1. So far I am getting the same error 
message. I had this once before in a different application and the solution 
then was to create a completely new project and manually add all files back in. 
I will try that soon, but this is a big project and that is not an easy task. I 
was hoping the issue was similar.

Are the LC_VERSION_MIN_MACOSX and LC_FUNCTION_STARTS translations of 0x24 and 
0x26. I had been trying to target 10.5 and deploy to 10.4. That could not find 
the SDK in Xcode 4.1. I switched target to 10.6 (which builds, but lots of 
warnings) and left deploy at 10.4. I will try changing some more (but I am away 
from my development Mac until tonight)

On Jul 26, 2011, at 9:52 AM, Joseph Ranieri wrote:

> On Tue, Jul 26, 2011 at 2:39 AM, John Nairn  wrote:
>> I now managed to get some feedback. When running with debugger, the Xcode 
>> console lists
>> 
>> Program loaded.
>> run
>> [Switching to process 7184]
>> Running…
>> sharedlibrary apply-load-rules all
>> unable to read unknown load command 0x24
>> unable to read unknown load command 0x26
>> unable to read unknown load command 0x24
>> unable to read unknown load command 0x26
>> unable to read unknown load command 0x24
>> 
>> and then it is stuck?
>> 
>> 
>> John Nairn
>> http://www.geditcom.com
>> Genealogy Software for the Mac
> 
> What version of Xcode are you using to debug? These are load commands
> that were added in 10.7 (LC_VERSION_MIN_MACOSX and LC_FUNCTION_STARTS)
> and I would expect them to be recognized by Xcode 4.1.
> 
> -- Joe Ranieri

___

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: Dialog Command Keys

2011-07-26 Thread Matt Neuburg
On Tue, 26 Jul 2011 09:03:19 -0700, Bill Appleton 
 said:
>The items in the main menu DO have the standard key bindings, they are
>disabled when the modal dialogs come up

Well, that's a bug you need to fix. This might help:

http://www.cocoabuilder.com/archive/cocoa/119051-small-notes-on-enabling-of-menus-in-modal-window.html

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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: Dialog Command Keys

2011-07-26 Thread Bill Appleton
hi all

i set the target and the action on my menu items -- this is so that i can
get my handler called when someone selects a menu item
i will re-read the event handler docs with regard to menu items (no keyboard
issues) and see if that helps


thx

bill



On Tue, Jul 26, 2011 at 10:02 AM, Joar Wingfors  wrote:

>
> On 26 jul 2011, at 09:43, Raleigh Ledet wrote:
>
> >> Well, when the dialog field has selected text and i type command-x my
> menu
> >> item's action handler is NOT invoked, because there is a modal dialog up
> I
> >> guess.
> >
> > Wait! Are you saying that you modified the default target/action setup of
> the Cut menu in your main nib file? If so, that would explain everything.
>
>
> What Raleigh means is that the out-of-the-box behavior that we've been
> harping about here depends on these menu items being set up in the default
> way - with the default target (nil) and default actions. If you have
> configured them to have different targets / actions, then all bets are off.
> And again, that would imply that Kyle's suggestion to read up on Cocoa Event
> Handling would be in order.
>
> j o a r
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSTask oddity with getting stdout

2011-07-26 Thread Scott Ribe
On Jul 26, 2011, at 12:18 AM, Shane Stanley wrote:

>> On Jul 25, 2011, at 3:40 AM, Shane Stanley wrote:
>> 
 I wonder if they've changed how the readInBackgroundAndNotify works.
>>> 
>>> Yes, they have. I logged a bug on it, and was told that the way it worked in
>>> 10.6 was wrong -- whereas it used not to send a notification until there was
>>> something to read, it now returns one immediately regardless. Whether that's
>>> the problem here, I don't know.
>> 
>> That's absolutely demented. If it sends a notification immediately, with or
>> without data, then you're never really using it to read in the background,
>> you're almost just spinning in a busy loop, getting a probably empty NSData,
>> and calling readInBackgroundAndNotify again, as fast as the runloop can
>> deliver the notifications.
> 
> Exactly. I built a sample app that did exactly that, and logged radar
> #9120065. I was told that was correct behavior, and that "Snow Leopard's
> NSFileHandle never correctly notified with a zero length data at EOF". The
> suggested fix was "do a blocking -readDataOfLength: call on a background
> thread".

- Snow Leopard most certainly did correctly notify with a zero length data at 
EOF for me and did so sufficiently consistently that I am not aware of it ever 
failing to do so, in thousands of runs. Therefore "never" is clearly incorrect.

- I don't see how what you said "...it now returns one immediately 
regardless" follows from Apple's response that you quoted; maybe I'm 
missing some context.

- What good will a blocking readDataOfLength: call on a background thread do 
for the case where you don't know what's coming, need to process it as it 
comes, then need to know when it's closed? Are they seriously suggesting that 
we need to read a single character at a time using blocking reads on a 
background thread? That's such a lame suggestion that it would make me ask: why 
bother with NSTask and NSFileHandle and notifications at all? In that case 
POSIX APIs would be no harder to use, and would actually work.

- I set up some tests in Lion and ran them last night, and never had an 
instance of getting a notification with zero-length data before the pipe was 
closed. Only a few dozen runs, but still, 0-length data always indicated pipe 
close. (I modified the command-line process with a couple of obnoxious pauses, 
before sending anything and before sending the final lines, so that if there's 
some timeout it would be likely to be hit.)

Maybe you should try to re-open your bug ;-)

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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: Dialog Command Keys

2011-07-26 Thread Joar Wingfors

On 26 jul 2011, at 09:43, Raleigh Ledet wrote:

>> Well, when the dialog field has selected text and i type command-x my menu
>> item's action handler is NOT invoked, because there is a modal dialog up I
>> guess. 
> 
> Wait! Are you saying that you modified the default target/action setup of the 
> Cut menu in your main nib file? If so, that would explain everything.


What Raleigh means is that the out-of-the-box behavior that we've been harping 
about here depends on these menu items being set up in the default way - with 
the default target (nil) and default actions. If you have configured them to 
have different targets / actions, then all bets are off. And again, that would 
imply that Kyle's suggestion to read up on Cocoa Event Handling would be in 
order.

j o a r


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dialog Command Keys

2011-07-26 Thread Bill Appleton
hi all,

>> Wait! Are you saying that you modified the default target/action setup of
the Cut menu in your main nib file? If so, that would explain everything.
>> try starting again with a standard NIB and inspect each item to see what
things you may be missing.

i think this is the right track, our menus are also dynamically generated,
we don't use interface builder at all

the application has an .xib file from the "cocoa empty template" option in
interface builder

so i haven't modified this one way or the other




On Tue, Jul 26, 2011 at 9:45 AM, Gary L. Wade
wrote:

> You had mentioned earlier that your UI is programmatically generated; are
> your menus also in that category? If so, and they need to remain that way,
> try starting again with a standard NIB and inspect each item to see what
> things you may be missing.
>
> - Gary L. Wade (Sent from my iPhone)
>
>
___

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


ANN: CouchCocoa framework (CouchDB API)

2011-07-26 Thread Jens Alfke
tl;dr: CouchCocoa is a new Objective-C API for CouchDB on iOS and Mac OS. You 
can get it from . 

If you’re not familiar with CouchDB : it’s a popular 
“NoSQL” non-relational data store with a straightforward data model based on 
JSON, and flexible querying based on map-reduce. It has very powerful 
syncing/replication facilities that make it really easy to push and pull 
changes between any two instances (sort of like Git or Mercurial), and it 
scales well from mobile apps up to data centers.

CouchDB’s native API is HTTP, so calling it directly requires using 
NSURLConnection and parsing JSON. CouchCocoa hides that, so you can work with 
Objective-C classes like CouchDatabase and CouchQuery. But it’s not as 
high-level as CoreData: it doesn’t attempt to bridge your object model to 
CouchDB rows/documents.

The code is roughly at alpha level, by which I mean that it’s working, and 
suitable for people to start development with; but on the other hand you should 
expect bugs and limitations, and future API changes.

I’m excited to be developing this as part of my day job at Couchbase. This 
open-source framework will be a supported part of the Mobile Couchbase product. 
But it’s open source (Apache license, like CouchDB itself) and we welcome your 
contributions.

Repo & source code: https://github.com/couchbaselabs/CouchCocoa
Example snippets: 
https://github.com/couchbaselabs/CouchCocoa/wiki/Example-Snippets
iOS demo app: https://github.com/couchbaselabs/iOS-Couchbase-Demo
API docs: http://couchbaselabs.github.com/CouchCocoa/docs/

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dialog Command Keys

2011-07-26 Thread Gary L. Wade
You had mentioned earlier that your UI is programmatically generated; are your 
menus also in that category? If so, and they need to remain that way, try 
starting again with a standard NIB and inspect each item to see what things you 
may be missing.

- Gary L. Wade (Sent from my iPhone)

___

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: Dialog Command Keys

2011-07-26 Thread Joar Wingfors

On 26 jul 2011, at 09:32, Bill Appleton wrote:

> >>  OK, great. In that case it's weird that your cut/copy/paste items are not 
> >> enabled while a text field in your dialog has focus. You have focus set in 
> >> one of your text fields / views, right?
> 
> I just tried enabling the edit menu items when a dialog is up, that didn't 
> change anything. The NSTextField is blinking and typing into the field works, 
> so it has focus.


Note that Cut and Copy will only be enabled if you have something to Cut and 
Copy - In other words, you need a *selection* in the focused text field / view.


> >> Not sure what you mean with "not using the main app menu system"? I'd 
> >> argue that it should be, and that you should be using regular first 
> >> responder based menu item validation for making sure that only the menu 
> >> items that make sense are enabled during your modal session (again 
> >> something that typically works without any additional work on your part).
> 
> Well, when the dialog field has selected text and i type command-x my menu 
> item's action handler is NOT invoked, because there is a modal dialog up I 
> guess. On microsoft windows if you have a text field up on a dialog with 
> focus it just responds to control-x and cuts the text. It doesn't matter what 
> is happening in the application menus. 


The issue is not that you have a modal dialog up, event handling still works 
more or less the same way for modal dialogs. 


j o a r


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dialog Command Keys

2011-07-26 Thread Andy Lee
On Jul 26, 2011, at 12:32 PM, Bill Appleton wrote:
> On microsoft windows if you have a text field up on a dialog with
> focus it just responds to control-x and cuts the text. It doesn't matter
> what is happening in the application menus.

On the Mac, Command-X typically just works as well. The mechanism may be 
different (it probably goes through the Edit menu, in which "Cut" *should* be 
enabled), but it does normally work.

--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: Dialog Command Keys

2011-07-26 Thread Raleigh Ledet

On Jul 26, 2011, at 9:32 AM, Bill Appleton wrote:
> I just noticed that even if i bring up a stock dialog (like the put file
> dialog to save a file) that command-x still doesn't work. for these dialogs
> it DOES flash (hilite) that menu, but no cutting happens. So I don't think
> it matters how i am running the modal dialogs, because a stock dialog (cocoa
> is running) also has this problem.

Does cmd-x work in the Save panel of other applications. (Say Text Edit, 
Safari, etc…) I bet they do, and the corresponding Edit menu items are enabled 
in those dialogs as well. This tells me you have something wrong in your app.

> 
> Well, when the dialog field has selected text and i type command-x my menu
> item's action handler is NOT invoked, because there is a modal dialog up I
> guess. 

Wait! Are you saying that you modified the default target/action setup of the 
Cut menu in your main nib file? If so, that would explain everything.


-raleigh

___

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: Dialog Command Keys

2011-07-26 Thread Bill Appleton
I just noticed that even if i bring up a stock dialog (like the put file
dialog to save a file) that command-x still doesn't work. for these dialogs
it DOES flash (hilite) that menu, but no cutting happens. So I don't think
it matters how i am running the modal dialogs, because a stock dialog (cocoa
is running) also has this problem.



On Tue, Jul 26, 2011 at 9:29 AM, Andy Lee  wrote:

> On Jul 26, 2011, at 12:03 PM, Bill Appleton wrote:
> > The items in the main menu DO have the standard key bindings, they are
> > disabled when the modal dialogs come up
>
> That is odd. My question is, how do those menu items "know" to be enabled
> when we run a modal dialog the more usual way, using a nib? Seems like
> something I should know but I don't have the answer offhand. I'd search the
> docs but I have to run in a minute -- maybe the answer is in the doc "How
> Modal Windows Work"? Or in the event handling doc mentioned earlier?
>
> > The dialogs are modal
>
> Out of curiosity, how are you displaying your dialogs? Are you using [NSApp
> runModalForWindow:]? Using a modal session? Something else?
>
> --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: Dialog Command Keys

2011-07-26 Thread Bill Appleton
>>  OK, great. In that case it's weird that your cut/copy/paste items are
not enabled while a text field in your dialog has focus. You have focus set
in one of your text fields / views, right?

I just tried enabling the edit menu items when a dialog is up, that didn't
change anything. The NSTextField is blinking and typing into the field
works, so it has focus.

>> Not sure what you mean with "not using the main app menu system"? I'd
argue that it should be, and that you should be using regular first
responder based menu item validation for making sure that only the menu
items that make sense are enabled during your modal session (again something
that typically works without any additional work on your part).

Well, when the dialog field has selected text and i type command-x my menu
item's action handler is NOT invoked, because there is a modal dialog up I
guess. On microsoft windows if you have a text field up on a dialog with
focus it just responds to control-x and cuts the text. It doesn't matter
what is happening in the application menus.





On Tue, Jul 26, 2011 at 9:17 AM, Joar Wingfors  wrote:

>
> On 26 jul 2011, at 09:03, Bill Appleton wrote:
>
> > The items in the main menu DO have the standard key bindings, they are
> disabled when the modal dialogs come up
> > The items in the right-click menu do NOT have the key bindings but they
> are enabled, i didn't make these menus
> > The dialogs are modal
>
>
> OK, great. In that case it's weird that your cut/copy/paste items are not
> enabled while a text field in your dialog has focus. You have focus set in
> one of your text fields / views, right?
>
>
> > I agree it should just work. Is the problem that the main app menus need
> to be enabled when the dialogs are up? the dialogs are not using the main
> app menu system at that time...
>
>
> Not sure what you mean with "not using the main app menu system"? I'd argue
> that it should be, and that you should be using regular first responder
> based menu item validation for making sure that only the menu items that
> make sense are enabled during your modal session (again something that
> typically works without any additional work on your part).
>
>
> j o a r
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: App won't get to my code in Lion

2011-07-26 Thread Jens Alfke

On Jul 25, 2011, at 11:39 PM, John Nairn wrote:

> Program loaded.
> run
> [Switching to process 7184]
> Running…
> sharedlibrary apply-load-rules all
> unable to read unknown load command 0x24
> unable to read unknown load command 0x26
> unable to read unknown load command 0x24
> unable to read unknown load command 0x26
> unable to read unknown load command 0x24

Hm, I’m stumped. Those messages kind of sound like your executable is 
corrupted, but I’ve no idea how that would happen.
You might try reposting to the xcode-users list, as this seems like an issue 
with the tools rather than Cocoa itself.

—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dialog Command Keys

2011-07-26 Thread Andy Lee
On Jul 26, 2011, at 12:03 PM, Bill Appleton wrote:
> The items in the main menu DO have the standard key bindings, they are
> disabled when the modal dialogs come up

That is odd. My question is, how do those menu items "know" to be enabled when 
we run a modal dialog the more usual way, using a nib? Seems like something I 
should know but I don't have the answer offhand. I'd search the docs but I have 
to run in a minute -- maybe the answer is in the doc "How Modal Windows Work"? 
Or in the event handling doc mentioned earlier?

> The dialogs are modal

Out of curiosity, how are you displaying your dialogs? Are you using [NSApp 
runModalForWindow:]? Using a modal session? Something else?

--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: Dialog Command Keys

2011-07-26 Thread Joar Wingfors

On 26 jul 2011, at 09:03, Bill Appleton wrote:

> The items in the main menu DO have the standard key bindings, they are 
> disabled when the modal dialogs come up
> The items in the right-click menu do NOT have the key bindings but they are 
> enabled, i didn't make these menus
> The dialogs are modal


OK, great. In that case it's weird that your cut/copy/paste items are not 
enabled while a text field in your dialog has focus. You have focus set in one 
of your text fields / views, right?


> I agree it should just work. Is the problem that the main app menus need to 
> be enabled when the dialogs are up? the dialogs are not using the main app 
> menu system at that time...


Not sure what you mean with "not using the main app menu system"? I'd argue 
that it should be, and that you should be using regular first responder based 
menu item validation for making sure that only the menu items that make sense 
are enabled during your modal session (again something that typically works 
without any additional work on your part).


j o a r


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dialog Command Keys

2011-07-26 Thread Bill Appleton
The items in the main menu DO have the standard key bindings, they are
disabled when the modal dialogs come up

The items in the right-click menu do NOT have the key bindings but they are
enabled, i didn't make these menus

The dialogs are modal

I agree it should just work. Is the problem that the main app menus need to
be enabled when the dialogs are up? the dialogs are not using the main app
menu system at that time...


thanks in advance





On Tue, Jul 26, 2011 at 8:56 AM, Joar Wingfors  wrote:

>
> On 26 jul 2011, at 08:09, Bill Appleton wrote:
>
> > There ARE cut, copy, and paste items in this menu, but they DONT have any
> > command key bindings, maybe that is the problem? i didn't create this
> menu
> > in the first place
>
>
> Yes, that is at least part of the problem. If the items in your main menu
> doesn't have the standard key bindings set, your app won't respond to the
> standard set of keyboard shortcuts. Not too surprising, eh?   ;-)
>
> Secondly, all of this should for the most part "just work". If it doesn't,
> or if you think that you have to provide a lot of custom code to get it
> working, you're doing something wrong. I'd suggest studying up on Cocoa
> Event Handling, like Kyle suggested, in particular the concepts around the
> first responder.
>
> Are the dialogs that you mention modal? If not, how to you put them on
> screen?
>
> j o a r
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Dialog Command Keys

2011-07-26 Thread Joar Wingfors

On 26 jul 2011, at 08:09, Bill Appleton wrote:

> There ARE cut, copy, and paste items in this menu, but they DONT have any
> command key bindings, maybe that is the problem? i didn't create this menu
> in the first place


Yes, that is at least part of the problem. If the items in your main menu 
doesn't have the standard key bindings set, your app won't respond to the 
standard set of keyboard shortcuts. Not too surprising, eh?   ;-)

Secondly, all of this should for the most part "just work". If it doesn't, or 
if you think that you have to provide a lot of custom code to get it working, 
you're doing something wrong. I'd suggest studying up on Cocoa Event Handling, 
like Kyle suggested, in particular the concepts around the first responder.

Are the dialogs that you mention modal? If not, how to you put them on screen?

j o a r


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Fastest high-quality thumbnail display

2011-07-26 Thread James Merkel


On Jul 26, 2011, at 7:34 AM, Kyle Sluder wrote:


On Jul 26, 2011, at 7:04 AM, James Merkel  wrote:


Yeah, it looks like I can't use CIImage because of the memory leak.
Every time an image is opened, the memory footprint increases by  
the size of the image.

Using CIImage was kind of a cul-de-sac.


I don't see how this is unexpected behavior. You opened an image;  
shouldn't the image be in memory?




So now it looks like I have to use CGImage and figure out how to  
get a CGImageRef into an NSImageView which is ultimately how the  
image is displayed.


I'm pretty sure all image loading in the frameworks is done with  
ImageIO. You're not going to escape it by using CGImage.


Can you explain more about why you think this is a problematic leak  
and how it adversely affects you?


You might also try posting on quartz-dev.

--Kyle Sluder


I should have been more precise, namely: Every time an image is opened  
and *closed*, the memory footprint increases by the size of the image.
For example, if a 27.5 MB image is opened and closed 10 times, you end  
up with a memory footprint that has gown by 275 MB. The memory never  
gets freed up.
This is a problem related to a CIImage memory leak and was discussed a  
few years ago. Do a Google search or archives search with the terms  
"CIImage memory leak" (without quotes).


Actually, I don't think the problem is in ImageIO -- I was just  
referring to Instruments Object Allocations wherein if you click on  
the offending GeneralBlock, Instruments says the "Responsible Library"  
is ImageIO.


Jim Merkel

___

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: Dialog Command Keys

2011-07-26 Thread Bill Appleton
The main edit menu items are disabled when the dialog(s) come up.





On Tue, Jul 26, 2011 at 8:23 AM, Kyle Sluder  wrote:

> On Jul 26, 2011, at 8:09 AM, Bill Appleton 
> wrote:
>
> And when i right-click in them i get a clever menu with search in google,
> convert to uppercase, etc.
>
>
> Please note I said "menu bar," not "right-click menu." What about the items
> on the Edit menu?
>
> --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: Dialog Command Keys

2011-07-26 Thread Kyle Sluder
On Jul 26, 2011, at 8:09 AM, Bill Appleton  
wrote:

> And when i right-click in them i get a clever menu with search in google, 
> convert to uppercase, etc.

Please note I said "menu bar," not "right-click menu." What about the items on 
the Edit menu?

--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: Dialog Command Keys

2011-07-26 Thread Bill Appleton
Whoops yes, command-x

So i create some NSTextFields on the dialog window

(can't use Interface Builder, this is a dynamically created dialog)

And when i right-click in them i get a clever menu with search in google,
convert to uppercase, etc.

There ARE cut, copy, and paste items in this menu, but they DONT have any
command key bindings, maybe that is the problem? i didn't create this menu
in the first place


thx




On Tue, Jul 26, 2011 at 8:00 AM, Kyle Sluder  wrote:

> On Jul 26, 2011, at 7:52 AM, Bill Appleton 
> wrote:
>
>
> BUT my question is that it seems like there ought to be an easy or
> automatic way to do this. If i right-click on a text control i get a pop up
> menu with cut, copy, and other options. That same control isn't smart enough
> to handle the control-X key? It just seems strange, I'm looking for the
> right way to do this & don't want to reinvent the wheel for controls in a
> dialog.
>
>
> First, it's Command-X, not Control-X.
>
> Secondly, the way that key equivalents work is that they're sent to the
> menu bar first. In this case, the Cut menu item on the Edit menu should
> claim the Cmd-X shortcut, and then begin it's -validateMenuItem: process
> down the responder responder chain. Since you're talking about cutting text,
> that means you're using an NSTextField, right? The NSTextField's field
> editor responds to -cut: so -validateMenuItem: will be called on the field
> editor. It should return YES if the field is editable, which will cause the
> menu item to send its action (-cut:) to the field editor.
>
> No custom implementation of -performKeyEquivalent: is required.
>
> So: what happens if you select some text in your text field and bring up
> the Edit menu? Is the Cut item disabled? Does it have the proper shortcut
> listed next to it?
>
> --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: Dialog Command Keys

2011-07-26 Thread Kyle Sluder
On Jul 26, 2011, at 7:52 AM, Bill Appleton  
wrote:


> BUT my question is that it seems like there ought to be an easy or automatic 
> way to do this. If i right-click on a text control i get a pop up menu with 
> cut, copy, and other options. That same control isn't smart enough to handle 
> the control-X key? It just seems strange, I'm looking for the right way to do 
> this & don't want to reinvent the wheel for controls in a dialog.

First, it's Command-X, not Control-X.

Secondly, the way that key equivalents work is that they're sent to the menu 
bar first. In this case, the Cut menu item on the Edit menu should claim the 
Cmd-X shortcut, and then begin it's -validateMenuItem: process down the 
responder responder chain. Since you're talking about cutting text, that means 
you're using an NSTextField, right? The NSTextField's field editor responds to 
-cut: so -validateMenuItem: will be called on the field editor. It should 
return YES if the field is editable, which will cause the menu item to send its 
action (-cut:) to the field editor.

No custom implementation of -performKeyEquivalent: is required.

So: what happens if you select some text in your text field and bring up the 
Edit menu? Is the Cut item disabled? Does it have the proper shortcut listed 
next to it?

--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: Dialog Command Keys

2011-07-26 Thread Bill Appleton
In the manual it says:

"However, subclasses of other Application Kit classes (including custom
views) need to provide their own implementations of performKeyEquivalent:.
The implementation should extract the characters for a key equivalent from
the passed-in NSEvent object using the charactersIgnoringModifiers  method
and then examine them to determine if they are a key equivalent it
recognizes. It handles the key equivalent much as it would handle a key
event in keyDown"

i can do that manually for each control in my dialog.

BUT my question is that it seems like there ought to be an easy or automatic
way to do this. If i right-click on a text control i get a pop up menu with
cut, copy, and other options. That same control isn't smart enough to handle
the control-X key? It just seems strange, I'm looking for the right way to
do this & don't want to reinvent the wheel for controls in a dialog.


Best






On Mon, Jul 25, 2011 at 9:47 PM, Kyle Sluder  wrote:

> On Mon, Jul 25, 2011 at 1:43 PM, Bill Appleton
>  wrote:
> > Hi all,
> >
> > Based on my app, the dialog boxes have to be created dynamically, so i
> can't
> > use Interface Builder, so they are assembled out of cocoa controls as
> > needed.
> >
> > My dialogs beep when i control-x to cut some selected text
> >
> > What is the simple way for my dialog window to pass these command keys
> > events down to the text views?
>
> Please read the Cocoa Event Handling Guide:
>
> http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/Introduction/Introduction.html#//apple_ref/doc/uid/1060i-CH1-SW1
>
> --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: [SOLVED] Problem getting my layers to draw in the right order

2011-07-26 Thread Kyle Sluder
On Jul 26, 2011, at 7:13 AM, Graham Cox  wrote:

> Anyway, what I've learned is that the z values need to be big, and probably 
> not terribly precise.

David Duncan's post in this thread seems relevant: 
http://www.cocoabuilder.com/archive/cocoa/193266-reordering-calayer-sublayers-without-raping-my-performance.html

>From the description given in the documentation, I would think that because CA 
>is sorting the layers based on sibling order and zPosition that it would be 
>possible to render a layer of zPosition=0 atop a nephew layer with 
>zPosition=1000.

But I can see why this would be difficult: Core Animation apparently applies 
the zPosition to the layer's GL quad. In order to support rendering zPosition=0 
atop zPosition=1000, it would need to maintain a copy of the depth buffer at 
each level of the layer. Rendering a layer would involve a depth test, then 
copying the depth buffer to be used when rendering the sublayers and discarding 
that depth buffer when done.

That's a *ton* of time- and memory-intensive copies.

This is a place where the abstraction leaks. I think the documentation should 
be updated to make it clearer that zPosition can't be used for general Quartz 
Transparency Layer type effects, which it seems to imply. We should also 
probably get a CALayerGroup layer class that *does* render all of its sublayers 
into a quad whose z position is equal to that of the CALayerGroup's zPosition 
property.

--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: Fastest high-quality thumbnail display

2011-07-26 Thread Kyle Sluder
On Jul 26, 2011, at 7:04 AM, James Merkel  wrote:

> Yeah, it looks like I can't use CIImage because of the memory leak.
> Every time an image is opened, the memory footprint increases by the size of 
> the image.
> Using CIImage was kind of a cul-de-sac.

I don't see how this is unexpected behavior. You opened an image; shouldn't the 
image be in memory?

> 
> So now it looks like I have to use CGImage and figure out how to get a 
> CGImageRef into an NSImageView which is ultimately how the image is displayed.

I'm pretty sure all image loading in the frameworks is done with ImageIO. 
You're not going to escape it by using CGImage.

Can you explain more about why you think this is a problematic leak and how it 
adversely affects you?

You might also try posting on quartz-dev.

--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


[SOLVED] Problem getting my layers to draw in the right order

2011-07-26 Thread Graham Cox
OK, turns out that the zPosition property of the layers is important here. I 
was setting them to values like 100, and -100. That turns out to be way too 
small - the perspective/rotation transform I was applying to the 'behind' 
layers was swinging these layers into a zPosition that greatly exceeds these 
numbers. Changing to values like 1000 fixes the issue. It's a bit hard to get a 
feel for what these numbers mean - it must hugely depend on what sort of  
"camera field of view" (or whatever the right terminology is - focal length?) 
for the Core Animation 3D system.

Anyway, what I've learned is that the z values need to be big, and probably not 
terribly precise.


--Graham





On 26/07/2011, at 11:31 AM, Graham Cox wrote:

> Hi David,
> 
> 
> This sounds somewhat close to what I have already. My layer hierarchy is:
> 
> 
>Root
> |
>-
>||   |
> Rep1Rep2   Rep3
>||   |
>     |
> | | | |  |
> L1   L2   R1R2 Text
> 
> 
> Where L1, L2, R1 and R2 are custom CALayer subclasses that draw the coloured 
> bars, and Rep 1..3 are the replicator layers that provide the reflective 
> effect. (Sidenote: I'm pretty sure it's not possible to create the reflection 
> effect I want using a single rep layer, as each one is set to a different 
> perspective transform).
> 
> The 3 replicator layers are siblings, where Rep3 which hosts the text is 
> added last and should therefore draw last, i.e. on top. (I've tested this 
> assumption by trying to move it elsewhere in the sublayers list using 
> -insertSublayer:atIndex: but this doesn't appear to change anything.
> 
> I also found that the text is not just being overwritten by the replicator 
> layer's drawing - if I set its position to overlap the actual content (L1, 
> R1, etc) it is also drawn over by the main content, so it does seem to simply 
>  be in the wrong place in the drawing order.
> 
> One strange thing was that for a while, it started to work correctly, without 
> me doing anything, then some cycles of dev and debugging later elsewhere in 
> the code, reverted to this behaviour. The code I was working on was nothing 
> to do with the graphical layers at all. This suggests that maybe there's 
> something a bit random going on in establishing which layer gets to draw when.

___

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: Fastest high-quality thumbnail display

2011-07-26 Thread James Merkel


On Jul 26, 2011, at 1:39 AM, Mike Abdullah wrote:



On 26 Jul 2011, at 01:55, James Merkel wrote:


Well, I see I have a huge memory leak in CIImage.
However, I don't see where my code is in error.
Also, according to Instruments Object Allocation, ImageIO is  
holding this memory.

So I guess Core Image calls IImageIO.


Yes, since ImageIO's job is to read and write images, Core Image  
uses it to do that portion of its work.




Yeah, it looks like I can't use CIImage because of the memory leak.
Every time an image is opened, the memory footprint increases by the  
size of the image.

Using CIImage was kind of a cul-de-sac.

So now it looks like I have to use CGImage and figure out how to get a  
CGImageRef into an NSImageView which is ultimately how the image is  
displayed.


Jim Merkel
___

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


Cancelling a CATransaction's completionBlock

2011-07-26 Thread Graham Cox
I'm using a completion block with CATransaction to clear a few ivars when an 
animation finishes. The animation takes quite a few seconds, so it's quite easy 
for an event which 'undoes' the same animation to arrive during that time. 
That's no big problem - the animation just goes to the new value. Problem is 
that the completionBlock still runs, so the variable gets cleared, when on this 
occasion it shouldn't.

I could set up some flags that the completion block can check before it does 
its work (messy), or I could just cancel the current transaction (clean). But, 
I can't seem to find out if that's possible. The docs and methods of 
CATransaction don't seem to have anything that would allow this.

What should I do?

--Graham




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Disable Lion's window restoration?

2011-07-26 Thread Jean-Daniel Dupas

Le 26 juil. 2011 à 02:33, Gerd Knops a écrit :

> Hi,
> 
> Is there an application-global way of disabling window restoration?
> 
> All I can find is NSWindow's "- (BOOL)isRestorable" method (and it's 
> relatives).
> 
> I was hoping for something more global, like a "- (BOOL)shouldRestoreWindows" 
> method in the application delegate protocol or the NSDocumentController class 
> or somewhere.
> 
> Thanks
> 
> Gerd

The key used by System Preferences to managed this setting is 
NSQuitAlwaysKeepsWindows, and it is stored in the global user defaults domain.
I think you can override this setting per application by explicitly setting 
this user default to false in your application.
I don't know if it works, but it may be worth the try.

-- Jean-Daniel




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


[ANN] LuaCocoa v.0.3 released

2011-07-26 Thread Eric Wing
I am happy to announce the third public release of LuaCocoa (v. 0.3).
This version is mostly a Xcode 4 and Lion compatibility release, but
also includes a handful of improvements.

LuaCocoa is a next generation Lua/Objective-C bridge that uses
BridgeSupport and libffi on Mac OS X to provide full automatic
bindings to Objective-C and the more difficult areas of the platform
such as functions, macros, structs, constants, enums, etc. LuaCocoa is
under the MIT License.


Release Notes for v 0.3: (Xcode 4 / Lion compatibility changes, final
PowerPC release?)

- Changed LuaCocoa to use the non-'Full' .bridgesupport files instead
of the 'Full' bridgesupport files because Lion removed the 'Full'
versions without warning.
- As fallout from this change, LuaCocoa no longer requires Obj-C
classes to be fully specified in BridgeSupport data to refer to them
in Lua code (i.e. Using NSClassFromString to refer to a is no longer
necessary to refer to an unspecified class.)

- Added new Xcode 4 project to deal with Xcode 4 compatibility, plus
minor Xcode script phase compatibility fixes.
- This might be the last PowerPC release because building PowerPC is
hard in Xcode 4 and Lion

- Remove use of helper categories in LuaCocoa implementation to avoid
headaches with static linking.

- Added APIS: LuaCocoa_PrependToLuaSearchPath,
LuaCocoa_PrependToCSearchPath, LuaCocoa_AppendToCSearchPath. These
APIs help you add more search paths for Lua plugins and Lua files.
- The LuaCocoa class will add the .app bundle's PlugIns path to the
begining of the search path.
- The luacocoa shell tool has been modified to look in
*/Library/Application Support/LuaCocoa/PlugIns for additional .so
modules, and */Library/Application Support/LuaCocoa/Scripts for
additional .lua scripts.

- Bug fix for returning const char* (strings) through the bridge, e.g.
nstring:UTF8String().

- Added new preprocessor define LUACOCOA_DONT_USE_BUNDLED_LUA_HEADERS
so #include "lua.h" can be used instead of  in case
people need to use a custom version of Lua which is not located in a
LuaCocoa subdirectory (for people building LuaCocoa themselves).

- Optional Source Code: Added simple lua_isinteger implementation to
stand in for projects that need LuaCocoa but use a stock version of
Lua without LNUM. It is located the the directory: 'etc'

- Updated bundled LPeg to 0.10.

- Doxygen (in repo): Experimenting with man page generation in
addition to html and Xcode DocSets



To learn more about LuaCocoa and grab the binaries, please visit:
http://playcontrol.net/opensource/LuaCocoa/

-Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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: How can i change a app position and size?

2011-07-26 Thread Bill Cheeseman

On Jul 26, 2011, at 1:02 AM, Jens Alfke wrote:

> On Jul 24, 2011, at 4:14 PM, Diego Alvarez Nogueira wrote:
> 
>> How can i change a app position and size by Pid number?
> 
> You mean resizing other apps’ windows? I think the only option is using UI 
> Scripting, where you can send an app AppleEvents that generate fake user 
> input events like clicks and drags. Look it up in the developer documentation.


Or use Apple's accessibility API directly. GUI Scripting is built on top of the 
accessibility API.

-- 

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: Fastest high-quality thumbnail display

2011-07-26 Thread Mike Abdullah

On 26 Jul 2011, at 01:55, James Merkel wrote:

> Well, I see I have a huge memory leak in CIImage.
> However, I don't see where my code is in error.
> Also, according to Instruments Object Allocation, ImageIO is holding this 
> memory.
> So I guess Core Image calls IImageIO.

Yes, since ImageIO's job is to read and write images, Core Image uses it to do 
that portion of its work.

___

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