Re: How EXC_BAD_ACCESS in objc_msgSend if receiver, parms OK?

2012-02-23 Thread Greg Parker
On Feb 20, 2012, at 10:16 AM, Matt Neuburg m...@tidbits.com wrote:
 On Fri, 17 Feb 2012 16:06:01 -0800, Greg Parker gpar...@apple.com said:
 No. objc_msgSend() also reads from the class's method cache and method list. 
 It's possible for the receiver object to be valid, but still crash because 
 of a memory smasher that hit the method cache or method list
 
 It's also possible for the receiver object to be valid but the wrong object. 
 I remember in my early Cocoa programming days I mismanaged the memory for an 
 NSString object and was mystified when *another NSString object took its 
 place*. I believe NSZombie would have tracked that down by occupying the slot 
 pointed to by the variable and not letting some other string slip into it. In 
 other words, believe in zombies, not in your intuitions about how everything 
 looks okay. :) m.

Having a prematurely-deallocated object replaced by a new object of the same 
type can lead to all sorts of exciting bugs, but a crash in objc_msgSend() 
itself is not one of them. (And yes, NSZombie is good at catching such cases. 
The dead object's address will not be re-used, at least not any time soon.)


-- 
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSStepper - useless?

2012-02-23 Thread Keary Suska
On Feb 19, 2012, at 5:11 PM, William Squires wrote:

 Okay, 'nuther dumb question. How do I hook the different arrows in an 
 NSStepper to actions in my view controller? Or how do I ask (id)sender which 
 arrow was clicked?

You can't, at least not specifically, on both counts. All the stepper does is 
increment or decrement a numeric value. That's it. If you keep track of the 
last value set, you can determine whether the value went up or down, which 
would indicate which button was pressed.

HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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

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

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

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


Re: NSTextView and -becomeFirstResponder

2012-02-23 Thread Conrad Shultz
On 2/19/12 9:29 PM, Jim McGowan wrote:
 Hi,
 
 I have an NSTextView subclass and I need it to inform another object
 of when it becomes first responder - along the lines of overriding
 -becomeFirstResponder something along the lines of this:

Subclassing seems like too much of a sledgehammer.

How about you approach this in reverse: have the other object observe
the text view's window's firstResponder?

(Of particular note: In Mac OS X v10.6 and later, firstResponder is
key-value observing compliant.)

-- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSStepper - useless?

2012-02-23 Thread Jens Alfke

On Feb 19, 2012, at 4:11 PM, William Squires wrote:

 Okay, 'nuther dumb question. How do I hook the different arrows in an 
 NSStepper to actions in my view controller? Or how do I ask (id)sender which 
 arrow was clicked?

NSStepper is intended to keep track of the value for you, so when the user 
clicks an arrow the stepper updates its value and notifies the target, which 
can then look at the control’s value.

If you just need a pair of little arrows that will do something else than 
increment a number, you’re probably better off making two little NSButtons.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


text field question

2012-02-23 Thread Rick C.
Hi,

I have a panel with a number of text fields where a user should enter numeric 
values.  These text fields are setup with Sent on End Editing so that if the 
user presses enter or tabs or changes text fields the value will be entered.  
The problem is sometimes a user just types in a value and that's it...no enter, 
no tab, no changing text fields and the value is never received.  How does 
everyone else handle this and what can you recommend?  Thanks,

rc

PS - My apologies if this was duplicated due to the mailing list being offline 
for the past day...
___

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

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

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

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


Re: NSTextView and -becomeFirstResponder

2012-02-23 Thread Jim McGowan
On 23 Feb 2012, at 05:47, Kyle Sluder kyle.slu...@gmail.com wrote:

 On Sun, Feb 19, 2012 at 9:29 PM, Jim McGowan jim_mcgo...@mac.com wrote:
 However, I'm a bit confused by the docs.  -becomeFirstResponder is marked as 
 being deprecated for NSTextView, but not deprecated in its superclass 
 NSResponder.  The NSTextView docs for this method reads:
 
 Informs the receiver that it’s becoming the first responder. (Available in 
 Mac OS X v10.0 through Mac OS X v10.4. Use the NSWindowmethod 
 makeFirstResponder: to make a text view the first responder.)
 
 I suspect what actually happened is that
 -{become,resign}FirstResponder were removed from the header file to
 reduce the temptation to call them directly rather than go through
 -[NSWindow makeFirstResponder:]. The deprecation is just how the doc
 generation tools interpreted their removal.

Yeah, that sounds plausible. I'll file the bug and see if anything comes of it.

Jim
___

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

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

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

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

Re: NSTextView and -becomeFirstResponder

2012-02-23 Thread Jim McGowan
On 23 Feb 2012, at 08:31, Conrad Shultz con...@synthetiqsolutions.com wrote:

 On 2/19/12 9:29 PM, Jim McGowan wrote:
 Hi,
 
 I have an NSTextView subclass and I need it to inform another object
 of when it becomes first responder - along the lines of overriding
 -becomeFirstResponder something along the lines of this:
 
 Subclassing seems like too much of a sledgehammer.
 
 How about you approach this in reverse: have the other object observe
 the text view's window's firstResponder?

Good point about observing -firstResponder, but I'm already creating the 
subclass for a bunch of other reasons, so it was convenient override 
-becomeFirstResponer.

Jim
___

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

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

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

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


Re: NSStepper - useless?

2012-02-23 Thread John Joyce

On Feb 19, 2012, at 6:11 PM, William Squires wrote:

 Okay, 'nuther dumb question. How do I hook the different arrows in an 
 NSStepper to actions in my view controller? Or how do I ask (id)sender which 
 arrow was clicked?
 
Remember that classes tend to inherit from superclasses.
Not checking superclasses will get you every time with AppKit.
Try AppKiDo for a great tool that makes it really really easy to see all of the 
documented methods a class responds to at once, including its inherited methods.

In this case NSControl has your answer.

If what you are really after is a vertical segmented button, you can create 
that easily.

In this case, you will get a zero or a 1.

A simple conditional statement will get you where you probably want to go with 
this.


On a side note, please consider your post titles more thoughtfully.
2 reasons:
1) Many users search the archives, often via google.
2) Thoughtless titles like it doesn't work often get ignored by some of the 
most insightful and active people on the mailing list.
___

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

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

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

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


iCal Integration

2012-02-23 Thread Jeremy Matthews
I have a simple app which, as a byproduct, creates tasks and events in iCal. 
Prior to 10.7, the user would choose from a popup list populated by all 
calendars within the [CalCalendarStore defaultstore], which worked great and 
created both events and tasks perfectly fine.

Now, in 10.7, it seems as if a CalDAV (alal iCloud) or Exchange calendar is 
separated into two separate objects - one for events and one for tasks, and the 
result is the user is shown a list of calendars...and in many cases users 
appear to see duplicates, when in reality there are those two separate 
calendars.

So now, when a user selects the calendar, they might get an event created, but 
not tasks, and vice-versa. 

Is there any known way of dealing with this, or any way to easily find out 
which calendar supports events vs tasks, instead of firing off a test tasks 
and finding out the hard way? Or perhaps, a better solution altogether?

Thanks,
jeremy
___

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

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

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

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


App Crashing in ARC !!

2012-02-23 Thread Naresh Kongara
HI,

I'm working on a Cocoa Desktop application, which we recently migrated from 
Manual memory to ARC.

Application is sometimes crashing when the alert is closed.

Here is the crash log and stack trace.

*** -[NSPanel release]: message sent to deallocated instance 0x111c74a60


#0  0x7fff8ffd1da7 in ___forwarding___ ()
#1  0x7fff8ffd1c88 in __forwarding_prep_0___ ()
#2  0x7fff8ff49ca0 in CFRelease ()
#3  0x7fff8ff72180 in -[__NSArrayM dealloc] ()
#4  0x7fff8791003c in (anonymous namespace)::AutoreleasePoolPage::pop ()
#5  0x7fff8ff72b05 in _CFAutoreleasePoolPop ()
#6  0x7fff935e97dc in _dispatch_worker_thread2 ()
#7  0x7fff8a9b93da in _pthread_wqthread ()
#8  0x7fff8a9bab85 in start_wqthread ()



I'm creating the alert with class method in NSAlert and running it with 
runModal.

NSAlert *alert =[NSAlert 
alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:];
if ([alert runModal] == NSAlertDefaultReturn) {
//Code
}
This crash is happening only after we migrated to ARC. I tried with analyzer 
and Zombies, but no success in finding the cause for the crash.

Did any body come across the similar issues (or) any idea on what might be the 
issue.


Thanks,
Kongara
___

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

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

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

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


Re: help with usb

2012-02-23 Thread Jens Alfke

On Feb 21, 2012, at 6:59 AM, ronald b. kopelman wrote:

 This involves learning how to program a usb device. I expect to do this, of 
 course in Obj-C.

I don’t know of any Objective-C USB APIs. I suspect you’re going to have to get 
jiggy with IOKit…

(In general, don't assume there are Objective-C APIs for everything in the OS. 
There is a lot of lower-level non-GUI stuff that’s accessible only through C. 
Which is still callable from a Cocoa app, of course, just not quite as 
convenient.)

—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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: help with usb

2012-02-23 Thread Scott Ribe
Your best bet is Apple's USB dev list.

On Feb 21, 2012, at 7:59 AM, ronald b. kopelman wrote:

 I expect to do this, of course in Obj-C. Can anyone point me in the direction 
 of some relevant literature regarding usb devices  how to read them


-- 
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: I added an exception breakpoint to my app...

2012-02-23 Thread Kyle Sluder
On Wed, Feb 22, 2012 at 7:53 AM, R r4eem...@gmail.com wrote:
 and now see:

 Catchpoint 2 (throw)Pending breakpoint 1 - objc_exception_throw
 resolved


 No further details.  The app appears to be fine with no errors or
 warnings.  Is this a problem?

 (SnowLeopard Xcode 4)

This the result of some non-obvious changes made between Xcode 3 and Xcode 4.

1. Break on Objective-C exceptions is on by default, which will
cause the debugger to break on objc_exception_throw.
2. Show Disassembly When Debugging is off by default, meaning that
when you break in the debugger Xcode will select the first frame on
the stack that contains _your_ code; often times this is the call to
NSApplicationMain().

The frequency of this question leads me to believe the defaults are
confusing and should be changed. But for now, the upshot is that you
can hit Continue and let the exception remain uncaught and logged to
the console, or you can examine the exception object directly using
gdb (`po $rsi` on 64-bit Intel).

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Determining user's clock preference on iOS

2012-02-23 Thread Rick Mann
I have a need to format times as either

24:mm

or

12:mm
  am

That is, if the user prefers a 24-hour clock, I want it to appear on a single 
line. If the user prefers a 12-hour clock, I want the  AM/PM designator to be 
rendered underneath the time (in smaller type).

Unfortunately, there's no format specifier for the hours of the day that 
indicates use the user's preferred format.

If I could determine the user's preference, then I'd just format it 
appropriately. Alternatively, I can use the short format style, and then 
parse out the AM/PM, but that seems more fragile across locales (are there 
locales that use something other than am and pm?).

Any suggestions?

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSStepper - useless?

2012-02-23 Thread Martin Hewitson

On Feb 22, 2012, at 09:11 PM, Seth Willits wrote:

 On Feb 19, 2012, at 4:11 PM, William Squires wrote:
 
 Okay, 'nuther dumb question. How do I hook the different arrows in an 
 NSStepper to actions in my view controller? Or how do I ask (id)sender which 
 arrow was clicked?
 
 You don't. You ask for the stepper's value. 

The best usage I've found is to have a property in your controller and bind the 
value of the stepper (and perhaps the associated text box) to the property. You 
could also then observe changes to the property with KVO, if you so desire.

Martin

 
 
 --
 Seth Willits
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de
 
 This email sent to martin.hewit...@aei.mpg.de


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson







___

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

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

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

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


ImageCapture + ImageKit problem...

2012-02-23 Thread Eric Matecki

Hi,

I have a problem with ImageCapture + ImageKit.

My IKDeviceBrowserView stays desperately empty.

So I added the following code to the start of my app :
ICDeviceBrowser*  db = [[ICDeviceBrowser  alloc]  init];
[db  setDelegate: (idICDeviceBrowserDelegate)self];
db.browsedDeviceTypeMask = db.browsedDeviceTypeMask
| ICDeviceTypeMaskScanner
| ICDeviceTypeMaskCamera
| ICDeviceLocationTypeMaskLocal
| ICDeviceLocationTypeMaskShared
| ICDeviceLocationTypeMaskBonjour
| ICDeviceLocationTypeMaskBluetooth
| ICDeviceLocationTypeMaskRemote;
[db  start];

and deviceBrowser:didAddDevice:moreComing: *IS* called once, with the only 
scanner connected to my computer.
Still, the IKDeviceBrowserView stays empty.

What can be wrong ?

Oh, something that may be part of the problem (or of the solution...):

I don't call run on my app for multiplatform portability reasons.
Instead I call this in a customized event loop:
NSEvent*  event = [[NSApplication  sharedApplication]
  nextEventMatchingMask: NSAnyEventMask
  untilDate: [NSDate  
dateWithTimeIntervalSinceNow: 0.01]
 inMode: NSDefaultRunLoopMode
dequeue: YES];
/* OMITED: do some checks for tablet proximity events */
[[NSApplication  sharedApplication]  sendEvent: event];

Any help will be greatly appreciated.

Thanks.

--
Eric M.
http://www.tvpaint.fr
--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
___

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

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

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

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


Re: allow users to opt-out of iCloud

2012-02-23 Thread H. Miersch

On 21. Feb 2012, at 8:13, Martin Hewitson wrote:

 Dear list,
 
 If an app uses iCloud to sync data between machines, should we provide the 
 user a check-box to opt-out of iCloud syncing? Is there are recommended best 
 practice here? What are others doing?

from a user's point of view, i'd say yes, the user should have the option to 
choose. i don't want my data sent off to who-knows-where, especially without my 
knowledge or permission.
___

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

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

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

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


Re: Choosing correct ArrayController depending on active TableView

2012-02-23 Thread Mike Abdullah
The windows's first responder will tell you if one of the table views has 
focus. If there are other UI elements in the window which can have focus 
though, this won't be good enough. Instead you'll have to start tracking the 
first responder yourself and recording which table had it last

Sent from my iPad

On 21 Feb 2012, at 10:43 AM, Mikael Wämundson co...@wamundson.eu wrote:

 Hi,
 
 I have two ArrayControllers in IB, ArrayControllerA and ArrayControllerB, 
 who'scontent are setup to show in two TableViews, TableViewA and 
 TableViewB. Pressing a button in the interface will perform some actions on 
 the selected objects from TableViewA or TableViewB. I can of course select 
 objects in either of the two TableViews, but the most recent selected 
 TableView is active or focused.
 
 My question is: how do I, when pressing the button, get information on which 
 TableView is active, hence which ArrayController's content I should perform 
 actions on?
 
 Thanks!
 /Mikael
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: Can't create window context…crash

2012-02-23 Thread Mike Abdullah


Sent from my iPad

On 22 Feb 2012, at 10:17 PM, Gideon King gid...@novamind.com wrote:

 Hi all, I am seeing quite a number of reports from users of my software where 
 on the console, there are errors like the ones below, but I haven't been able 
 to reproduce the problem here:
 
 2012-02-21 23:49:05 +0800[3]: kCGErrorIllegalArgument: CGSDeviceCreate: 
 Invalid window
 2012-02-21 23:49:05 +0800[3]: Failed to create window context device
 2012-02-21 23:49:05 +0800[3]: CGWindowContextCreate: failed to create window 
 context delegate.

Certainly in my experience, lion's versions browser spits out messages like 
this. Possible in your case?
___

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

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

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

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


Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Markus Spoettl

Hello,

On 28.11.11 15:40, Richard Somers wrote:
 However, the mouseDown and mouseUp events always produce truncated 
coordinates.

 e.g. x:140.00 y:128.00

 This causes inaccuracy with hit testing between mouseMoved and 
mouseDown.


 Using floor, ceil, or round on the returned value does not work 
because the value can be off by as much as +-1.0.


Little late into this but I'm curious, did you manage to come up with a 
solution for the issue (I just ran into the same issue)?


As an illustration for the list, I have logged coordinates of a mouse 
move and a subsequent mouse down event that followed the move event:


mouseMovedToPoint:NSPoint: {217.15625, 343.3984375}
mouseDownAtPoint:NSPoint: {217, 344}

So it can happen that the hit-tests in -mouseMoved: and -mouseDown: 
return different objects in my view's object tree (which happens 
surprisingly often, btw.).


Anyone know how the system works out the integral coordinates?

Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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


Re: AXUIElementPostKeyboardEvent - not sending key presses to Safari/TextEdit in Lion

2012-02-23 Thread Bill Cheeseman

On Feb 20, 2012, at 9:29 PM, Mark Munz wrote:

 It was later determined that there is no intention of every allowing
 any kind of access to usability APIs from a sandboxed app. So they
 were apparently to afraid to just come out and say it, but instead
 used internal tracking option for the same effect.


I believe the current sandbox documentation expressly states that assistive 
applications will not work in the sandbox. This means that software intended to 
help users with disabilities must  not be sandboxed and cannot be distributed 
in the Mac App Store. And of course, the same applies to any utility 
applications that use the accessibility APIs for similar purposes, such as my 
own UI Browser and UI Actions products, as well as any applications based on 
Apple's own GUI Scripting AppleScript technology. Ditto for applications that 
send any AppleScript commands to other applications.

I suspect that Apple's recent announcements regarding Gatekeeper were in part 
dictated by Federal regulatory requirements regarding the Americans With 
Disabilities Act, which prohibits the federal government, as well as many state 
educational institutions that rely on federal money, from buying computers that 
do not comply with the ADA. Developers of assistive software and utilities 
relying on the accessibility API or AppleScript to control other applications 
must advise their customers running Mountain Lion to select the Gatekeeper 
option to run applications with developer IDs as well as applications purchased 
through the Mac App Store -- fortunately, that is the default setting.

These restrictions do not apply to applications that only respond to incoming 
accessibility API notifications or AppleScript commands. The documentation 
expressly encourages developers to continue to make their applications 
AppleScriptable, and of course the built-in and custom accessibility API 
support will continue to be available in the Cocoa frameworks and functional in 
sandboxed applications and in Mac App Store applications.

-- 

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Markus Spoettl

On 28.11.11 15:40, Richard Somers wrote:

I'm using a NSTrackingArea in a view to receive mouseMoved events.
The cursor location in the mouseMoved and mouseDragged events have
non-integer coordinates (as expected). e.g. x:140.601562
y:128.082031

However, the mouseDown and mouseUp events always produce truncated
coordinates. e.g. x:140.00 y:128.00

This causes inaccuracy with hit testing between mouseMoved and
mouseDown.


On Nov 26, 2011, at 10:58 AM, Ken Thomases wrote:


We've seen this, too.  It started happening with Lion.


Using floor, ceil, or round on the returned value does not work
because the value can be off by as much as +-1.0.

The amount of error in the value returned can be somewhat random. It
is not constant.


Little late into this but I'm curious, did you manage to come up with a 
solution for the issue (I just ran into the same thing)?


As an illustration for the list, I have logged coordinates of a mouse 
move and a subsequent mouse down event that followed the move event:


mouseMovedToPoint:NSPoint: {217.15625, 343.3984375}
mouseDownAtPoint:NSPoint: {217, 344}

It can (and does) happen that the hit-tests in -mouseMoved: and 
-mouseDown: return different objects that my view displays. My objects 
can be very close to each other and 1 pixel actually makes a difference.


Anyone know how to work out mouseDown coordinates one can expect to get 
when looking at mouseMove coordinates?


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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


Re: text field question

2012-02-23 Thread Michael Babin
On Feb 22, 2012, at 6:59 PM, Rick C. wrote:

 I have a panel with a number of text fields where a user should enter numeric 
 values.  These text fields are setup with Sent on End Editing so that if the 
 user presses enter or tabs or changes text fields the value will be entered.  
 The problem is sometimes a user just types in a value and that's it...no 
 enter, no tab, no changing text fields and the value is never received.  How 
 does everyone else handle this and what can you recommend?  Thanks,

If you're using bindings, set the Continuously Updates Value flag of the Value 
binding on your text field.

If you're not using bindings, implement the controlTextDidChange: method in the 
text field's delegate (if your text field doesn't have a delegate, set its 
delegate to the appropriate controller object).


___

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

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

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

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


Dumb question about radio buttons

2012-02-23 Thread William Squires
  I have a custom view with an NSBox containing an NSMatrix of button cells 
(radio buttons) When I created the NSMatrix, I told it I wanted 3 of them, but 
in the view hierarchy, I can see the NSMatrix under the NSBox, but it has 4 
button cells under it, not the three I asked for - Is this an Xcode/IB 
screw-up, or do NSMatrix's always add one extra element when making a group of 
radio buttons? Should I delete the matrix and try again? When I vertically 
resize the matrix, I always see three cells, so I don't think there's one 
hidden under there.
  Also, even though I set the tag for each button cell (the top one is 0, the 
next one down is 1, etc...), when I connect them to my

-(IBAction)baseChanged:(id)sender
{
int choice = [sender tag];
switch (choice)
  {
  case 0: // number base is 16 - hexadecimal
  NSLog(@user chose hexadecimal);
  ...
  break;

  case 1: // number base is 2 - binary
  NSLog(@user chose binary);
  ...
  break;

  case 2: // number base is 10 - decimal
  NSLog(@user chose decimal);
  ...
  break;
  }
self.numberBase = choice;
}

I always get, user chose hexadecimal! :( (all the buttons generate an action, 
so it's not that...)
  Am I supposed to connect the NSMatrix to the action, and not the individual 
cells? If so, how do I ask for the cell's tag value?



___

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

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

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

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


10.7 Auto Layout re-sizing question

2012-02-23 Thread Jonathan Waddilove
In the past I have managed to add a NSViewController's view to a subView of my 
window controller, usually something like

viewController = [[RemindersViewController alloc] 
initWithNibName:@RemindersViewController bundle:nil];
self.window.contentView = viewController.view;
[[viewController view] setFrame: [myView bounds]];

Now I'm trying to get with the program and use auto layouts. Both NIBs (window 
 view controller) have auto layout enabled and the contents of the VC view (a 
table) should re-size to fill the view.

Except  (of course) the re-sizing doesn't work. I'm obviously missing something 
very simple. Please could some kind person explain how we make the dynamically 
added subview correctly track into the parent views 'custom view'

Many thanks,  Jonathan




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Was: Re: NSStepper - useless?

2012-02-23 Thread William Squires
From what I've read, the NSStepper has a bug (though practically, you'll never 
see it); if one were to click the up or down arrow on the control 2^32 times 
(assuming it's value is a 4-byte signed int,and is initialized to 0), it would 
wrap around (or raise an exception for integer overflow). Probably not what 
the user had in mind! Why didn't they just make the NSStepper a custom view 
that draws two arrows, and has two sent actions that you can connect? Or even 
a variation of NSMatrix with two button cells that look like arrows. That 
would avoid the problem entirely, and be more intuitive to use.
___

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

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

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

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


Re: Localization for nibs

2012-02-23 Thread Ulf Dunkel

I believe that the single nib approach has been made more viable by Auto Layout in 
Lion, and expect to see more developers using single nib in the future.


When Auto Layout will auto-adjust the size of text containing objects in 
each and every NIB by giving us some smart controls how the adjustments 
should work, then the single NIB approach could be nice.


Removing the quantity of NIB files in the deployed app bundle could also 
add to the minimization of app weights.


Until then, we still prefer having separate localized NIBs, but with the 
One For All NIB layout method, where the English (or say your Base 
language) NIB objects are adjusted to the minimum size which is required 
by the longest text in one of the available languages.


A while ago, I have written a web page which explains how to optimize 
NIB layouts for localization.


http://www.icalamus.net/ioda/howto_niblayout.php?lan=en

And - oh, adjusting NIBs in multiple languages from a changed base 
language NIB layout is a piece of cake, using iLocalize.


Just my 2 cents,
---Ulf Dunkel
___

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

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

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

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


Re: text field question

2012-02-23 Thread Jan E. Schotsman


On Feb 23, 2012, at 7:56 AM, Rick C. wrote:


I have a panel with a number of text fields where a user should  
enter numeric values.  These text fields are setup with Sent on End  
Editing so that if the user presses enter or tabs or changes text  
fields the value will be entered.  The problem is sometimes a user  
just types in a value and that's it...no enter, no tab, no changing  
text fields and the value is never received.  How does everyone else  
handle this and what can you recommend?



I have Carbon app that starts a timer whenever typing occurs. After  
two seconds it accepts the text.
Not everybody likes it and I suppose you kindof may assume that most  
users know text entries must be confirmed by pressing enter or return  
or changing focus.


Jan E.
___

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

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

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

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


Re: text field question

2012-02-23 Thread Kyle Sluder
On Feb 22, 2012, at 4:59 PM, Rick C. rickcort...@gmail.com wrote:

 Hi,
 
 I have a panel with a number of text fields where a user should enter numeric 
 values.  These text fields are setup with Sent on End Editing so that if the 
 user presses enter or tabs or changes text fields the value will be entered.  
 The problem is sometimes a user just types in a value and that's it...no 
 enter, no tab, no changing text fields and the value is never received.  How 
 does everyone else handle this and what can you recommend?  

This is a FAQ, though the specifics of the answer are situation-dependent.

The gist is: send [panel makeFirstResponder:panel] at the appropriate time. Or 
it you're using bindings, send -commitEditing. The appropriate time in the 
case of a persistent panel is probably when it's about to lose key window 
status.

If your users want to see the results of their input without having to dismiss 
or leave the panel, they will understand having to press Return to commit 
editing.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Kyle Sluder
On Feb 22, 2012, at 10:50 PM, Rick Mann rm...@latencyzero.com wrote:

 I have a need to format times as either
 
24:mm
 
 or
 
12:mm
  am
 
 That is, if the user prefers a 24-hour clock, I want it to appear on a single 
 line. If the user prefers a 12-hour clock, I want the  AM/PM designator to be 
 rendered underneath the time (in smaller type).
 
 Unfortunately, there's no format specifier for the hours of the day that 
 indicates use the user's preferred format.

What happens if you give +[NSDateFormatter 
dateFormatFromTemplate:options:locale:] a template that contains h:m:s a? 
Does it rewrite it to H:m:s if the current locale uses 24-hour time?

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Sudden and hard to reproduce crashes in libcache

2012-02-23 Thread Fritz Anderson
On 21 Feb 2012, at 8:50 AM, Dragan Milić wrote:

 7   libc++abi.dylib   0x7fff8a1e505c std::terminate() + 16
 8   libc++abi.dylib   0x7fff8a1e6152 __cxa_throw + 114
 9   libobjc.A.dylib   0x7fff8a699e7a objc_exception_throw 
 + 327
 10  com.apple.CoreFoundation  0x7fff8c8b92a9 -[NSException raise] 
 + 9
 11  com.apple.ExceptionHandling   0x000100332e0a 
 NSExceptionHandlerUncaughtSignalHandler + 37
 12  libsystem_c.dylib 0x7fff900f0cfa _sigtramp + 26
 13  com.apple.CoreFoundation  0x7fff8c793c0b CFRelease + 27

The stack trace shows an uncaught NSException. Do you have the log from the 
time of the crash? Even if you can't reproduce it yourself, you can have a user 
look in Console, all messages, search for your application ID, and send you the 
results.

 I see the crash happens after CFRelease() call, but I can't figure out why. 
 If I try to do CFRelease(NULL), I get almost the same sequence…


Are you using ARC, by chance? Are any of the objects held as weak? Are you 
transferring them to Core Foundation without the proper bridging attribute?

If you can reproduce it yourself, here are some (possibly superstitious) things 
you could do:

Use the Breakpoint inspector (the [+] button) to set a breakpoint on 
exceptions. This may or may not tell you something. Assuming you are running on 
Intel, have a look at Tech Note 2124, Mac OS X Debugging Magic, to decode 
parameters from assembly (the section is Some Assembly Required). 
https://developer.apple.com/library/mac/#technotes/tn2124/_index.html

Enable zombies. Again, probably superstitious (unless the memory of the cached 
object was filled with a different one). Product  Edit Scheme…; Run  
Diagnostics  Enable Zombie Objects.

If you know the class of the expected object, use the Object Alloc instrument 
to collect allocation history (optionally with zombie detection) and see if 
there are excessive releases. You will have to do a throwaway run at first, and 
set the instrument's options to collect history and zombies.

— F


___

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

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

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

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

Loading existing NIB file from Cocoa?

2012-02-23 Thread Howard Moon
HI all,

I've got an audio plug-in that supports Windows and Carbon, and is 
being updated to support Cocoa (when the audio host is Cocoa-based).  On the 
Carbon side of things, I've got a .nib file that contains a few dialogs that I 
need to present to users, and I'm wondering if and how I can use this older 
.nib file in Cocoa.  When I try to load the nib using NSBundle loadNibNamed:, I 
get the following error:

Unable to load the Interface Builder file xx.nib because the object 
archive is missing. Valid nib files must contain either keyedobjects.nib, 
objects.nib, or data.nib.

I'm not sure how to proceed here.  Is it possible to modify my .nib 
file in some manner so that it works in Cocoa (and still works in Carbon)?  Or, 
do I have to make a new .xib for use with Cocoa, essentially doubling the work 
and resources in order to support both types?

Thanks,
Howard


___

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

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

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

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


Re: Was: Re: NSStepper - useless?

2012-02-23 Thread Kyle Sluder
On Thu, Feb 23, 2012 at 6:16 AM, William Squires wsqui...@satx.rr.com wrote:
 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind! Why didn't they just make the NSStepper a 
 custom view that draws two arrows, and has two sent actions that you can 
 connect? Or even a variation of NSMatrix with two button cells that look like 
 arrows. That would avoid the problem entirely, and be more intuitive to use.

Because NSStepper is over 20 years old, dating back to when the way to
push values around was to wire up a control's action to another
control's -takeValueFrom: method. Besides, all sorts of crazy things
tend to happen anyway when you try to use UINT_MAX for anything
useful.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: text field question

2012-02-23 Thread Kyle Sluder
On Thu, Feb 23, 2012 at 5:24 AM, Michael Babin mba...@orderndev.com wrote:
 I have a panel with a number of text fields where a user should enter 
 numeric values.  These text fields are setup with Sent on End Editing so 
 that if the user presses enter or tabs or changes text fields the value will 
 be entered.  The problem is sometimes a user just types in a value and 
 that's it...no enter, no tab, no changing text fields and the value is never 
 received.  How does everyone else handle this and what can you recommend?  
 Thanks,

 If you're using bindings, set the Continuously Updates Value flag of the 
 Value binding on your text field.

 If you're not using bindings, implement the controlTextDidChange: method in 
 the text field's delegate (if your text field doesn't have a delegate, set 
 its delegate to the appropriate controller object).

Both of these will defeat Rick's desired goal of _not_ having the
values update until the user chooses to.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: 10.7 Auto Layout re-sizing question

2012-02-23 Thread Kevin Cathey
Jonathan,

viewController = [[RemindersViewController alloc] 
 initWithNibName:@RemindersViewController bundle:nil];
self.window.contentView = viewController.view;
[[viewController view] setFrame: [myView bounds]];
Did you mean do make the content view of the window the view controller's view? 
Or did you mean to call addSubview instead on line 2?

In order for the loaded subview to correctly fill it's parent, you need to add 
constraints in code. Here's what I would do:

Load the view via some nib loading mechanism (preferably a view controller)
Ensure the view has translatesAutoresizingMaskIntoConstraints set to NO
When translatesAutoresizingMaskIntoConstraints is YES, the autoresizing is used 
to generate additional constraints. This can often cause conflicts if you're 
not expecting this, and this is a property intended only for transitioning 
applications. You want to turn this off so you can specify the position/size 
using constraints only.
By default, Xcode will set the value of 
translatesAutoresizingMaskIntoConstraints to YES for top level views, including 
those loaded for a view controller. The reason for this is also transitional: 
right now AppKit view subclasses usually expect subviews with 
translatesAutoresizingMaskIntoConstraints set to YES, and most applications are 
transitioning. Maybe some day in the future the default will be changed to NO.
You can set the value of translatesAutoresizingMaskIntoConstraints in code, or 
if you are using Xcode 4.3, you can use the View Attributes inspector to 
uncheck the value so translatesAutoresizingMaskIntoConstraints will be loaded 
from the nib with a value of NO.
Add as a subview
Add constraints

Using Mail as a compiler, here's the code snippet I would use:

   // Load the nib
   viewController = [[RemindersViewController alloc] 
initWithNibName:@RemindersViewController bundle:nil];
   NSView *mySubview = [viewController view];

   // Update the value of translatesAutoresizingMaskIntoConstraints if needed 
(or with Xcode 4.3+, do this in the Attributes Inspector in the NIB)
   [mySubview setTranslatesAutoresizingMaskIntoConstraints:NO];

   // Add as a subview
   [[[self window] contentView] addSubview:mySubview];

   // Add constraints constraining the subview to it's superview's edges
   [[[self window] contentView] addConstraints:[NSLayoutConstraint 
constraintsWithVisualFormat:@H:|[mySubview]| options:0 metrics:nil 
views:NSDictionaryOfVariableBindings(mySubview)]];
   [[[self window] contentView] addConstraints:[NSLayoutConstraint 
constraintsWithVisualFormat:@V:|[mySubview]| options:0 metrics:nil 
views:NSDictionaryOfVariableBindings(mySubview)]];

   // You cannot call setFrame anymore, since the value of the frame will just 
get stomped when the next layout pass happens.
   //[[viewController view] setFrame: [myView bounds]];


Kevin


On 23 Feb 2012, at 06:11, Jonathan Waddilove jonat...@waddilove.net wrote:

 In the past I have managed to add a NSViewController's view to a subView of 
 my window controller, usually something like
 
viewController = [[RemindersViewController alloc] 
 initWithNibName:@RemindersViewController bundle:nil];
self.window.contentView = viewController.view;
[[viewController view] setFrame: [myView bounds]];
 
 Now I'm trying to get with the program and use auto layouts. Both NIBs 
 (window  view controller) have auto layout enabled and the contents of the 
 VC view (a table) should re-size to fill the view.
 
 Except  (of course) the re-sizing doesn't work. I'm obviously missing 
 something very simple. Please could some kind person explain how we make the 
 dynamically added subview correctly track into the parent views 'custom view'
 
 Many thanks,  Jonathan
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/cathey%40apple.com
 
 This email sent to cat...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)

2012-02-23 Thread Antonio Nunes
I have a few popovers that, as far as I'm aware of, were working fine up to 
10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it 
often disappears, whether the click is on the background or on a UI item. I 
haven't figured out the trick exactly of the way in which clicking makes the 
popover go away, but it appears to be sensitive to how you click. A popover 
should never go away though when it is clicked upon. I think this is a bug in 
10.7.3. Various internet searches for this issue did not return any results, 
nor did searching Apple's developer forums.

Any ideas what might be causing this, or how to work around the issue? Has 
anyone else even encountered this issue?

-António

-
Accepting others as they are
brings a wonderful freedom
to your own mind.

--The Peace Formula
-





___

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

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

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

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

Re: Determining user's clock preference on iOS

2012-02-23 Thread Nick Zitzmann

On Feb 22, 2012, at 11:50 PM, Rick Mann wrote:

 If I could determine the user's preference, then I'd just format it 
 appropriately. Alternatively, I can use the short format style, and then 
 parse out the AM/PM, but that seems more fragile across locales (are there 
 locales that use something other than am and pm?).
 
 Any suggestions?


That is the only way to do it - look at the short format string returned by an 
NSDateFormatter and see if there is an a in it that does not appear inside 
quotes. The am and pm strings are localized for the user by the date 
formatter when turning a date into a string, so it's okay to just parse the 
format string returned by the date formatter (but not the results of feeding a 
date into it).

Nick Zitzmann
http://www.chronosnet.com/


___

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

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

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

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


Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Quincey Morris
On Feb 23, 2012, at 04:04 , Markus Spoettl wrote:

 As an illustration for the list, I have logged coordinates of a mouse move 
 and a subsequent mouse down event that followed the move event:
 
 mouseMovedToPoint:NSPoint: {217.15625, 343.3984375}
 mouseDownAtPoint:NSPoint: {217, 344}
 
 It can (and does) happen that the hit-tests in -mouseMoved: and -mouseDown: 
 return different objects that my view displays. My objects can be very close 
 to each other and 1 pixel actually makes a difference.
 
 Anyone know how to work out mouseDown coordinates one can expect to get when 
 looking at mouseMove coordinates?

I'll ask the stupid question:

How do you know (or, why do you assume) that these two sets of coordinates 
represent the same point? Even if the user did a press-and-hold, a 
high-resolution input device might detect some movement in the position. (At 
a sub-pixel level, I guess everyone has fat, wobbly fingers.)

Or, looking at it from the other end, in many applications it's desirable to 
debounce the mouse position at the beginning of dragging, to prevent unwanted 
short drags. By debounce, I mean deferring the initial move of the dragged 
object until the mouse position has moved by at least a couple of pixels from 
the mouse-down position. In such a scenario, a mouse-moved location has to be 
co-ordinated with the dragging state. I think your scenario is similar -- 
whatever code is using the mouse-moved position must take account whether the 
mouse is already down.


___

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

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

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

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


Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Markus Spoettl

On 23.02.12 18:53, Quincey Morris wrote:

Anyone know how to work out mouseDown coordinates one can expect to
get when looking at mouseMove coordinates?


I'll ask the stupid question:

How do you know (or, why do you assume) that these two sets of
coordinates represent the same point? Even if the user did a
press-and-hold, a high-resolution input device might detect some
movement in the position. (At a sub-pixel level, I guess everyone has
fat, wobbly fingers.)


I'm using a mouse and the cursor doesn't move between -mouseMove: and 
-mouseDown: (on screen). If the device would be capable of reporting 
sub-pixel movements (which may not be reported by moving the cursor), I 
guess it would have done so by sending an additional -mouseMove: event. 
If it didn't, I have to assume it didn't notice any movement and 
therefore didn't report any.


That (maybe flawed) theory asside, I just know that it didn't move 
because as an operator I made sure of it (when hunting a bug like this, 
one first assumes operator mistakes, I did too).


Up until now ( Lion), it was guaranteed (well, maybe not that, it just 
happened to work that way) that the -moveMoved: location corresponded to 
the subsequent -mouseDown: location. That meant that any hover-effects 
visualized during -mouseMoved: would have been rendered on objects that 
react in some way when the mouse goes down on them.


Of course this can be worked around (maybe by ignoring -mouseDown: 
coordinates if deemed sensible in the situation). It just complicates 
things by having to remember more state than was necessary before. And 
it was a surprise.



--
__
Markus Spoettl
___

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

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

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

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


Re: Localization for nibs

2012-02-23 Thread Gary L. Wade
What I've done that works for pre-Lion sizing and works for practically
all needs for a single NIB is to do this:

1. Devise a specially-designed key path that tells me the following:
   A. A tag that identifies it's my localized format
   B. String key
   C. The string table name (if empty, fall back to Localizable)
   D. Visual pinning of the object
   E. A tag that marks the item as a tooltip
2. Write a function that parses the key to see if it's encoded with my
special mechanism and its settings.
3. Add a -valueForKey: method to my application delegate and see if the
key matches my pattern.  If not, just call the super class's method
(including any application-specific needs first).
4. For text fields, add a value binding to the application with
self.delegate and the specially-designed key path.
5. For tooltips, add a tool tip binding to the application with
self.delegate and the specially-designed key path, adding the tag for a
tool tip.  No need for the visual pinning value.
6. For buttons and button cells in a matrix, add a title binding to the
application self.delegate and the specially-designed key path.

7. Add a call to a function within -windowDidLoad or other
post-NIB-handling method that will call a function that adjusts views
based on a pinning tag (left, right, top, bottom, or some relevant
combination).  The function will traverse all views and matrix cells to
see if they have the same kind of key for bindings with adjustment
pinnings and resize them accordingly and modify each frame.
8. For lookup of localization settings while running your app (i.e., the
string table and key being used), utilize some special setting, such as a
debug menu option or special modifier key toggle, and when retrieving the
actual string, return the table name and key rather than the desired
string.

Once you've done the heavy lifting of defining, parsing, and sizing with
the key paths, this method works beautifully.  You can still add the
default language values within each text field or control for visual
identification within Interface Builder.
--
Gary L. Wade
http://www.garywade.com/


On 02/23/2012 7:24 AM, Ulf Dunkel dun...@calamus.net wrote:

 I believe that the single nib approach has been made more viable by
Auto Layout in Lion, and expect to see more developers using single
nib in the future.

When Auto Layout will auto-adjust the size of text containing objects in
each and every NIB by giving us some smart controls how the adjustments
should work, then the single NIB approach could be nice.

Removing the quantity of NIB files in the deployed app bundle could also
add to the minimization of app weights.

Until then, we still prefer having separate localized NIBs, but with the
One For All NIB layout method, where the English (or say your Base
language) NIB objects are adjusted to the minimum size which is required
by the longest text in one of the available languages.

A while ago, I have written a web page which explains how to optimize
NIB layouts for localization.

http://www.icalamus.net/ioda/howto_niblayout.php?lan=en

And - oh, adjusting NIBs in multiple languages from a changed base
language NIB layout is a piece of cake, using iLocalize.

Just my 2 cents,
---Ulf Dunkel


___

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

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

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

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


Re: text field question

2012-02-23 Thread Michael Babin

On Feb 23, 2012, at 7:24 AM, Michael Babin wrote:

 On Feb 22, 2012, at 6:59 PM, Rick C. wrote:
 
 I have a panel with a number of text fields where a user should enter 
 numeric values.  These text fields are setup with Sent on End Editing so 
 that if the user presses enter or tabs or changes text fields the value will 
 be entered.  The problem is sometimes a user just types in a value and 
 that's it...no enter, no tab, no changing text fields and the value is never 
 received.  How does everyone else handle this and what can you recommend?  
 Thanks,
 
 If you're using bindings, set the Continuously Updates Value flag of the 
 Value binding on your text field.
 
 If you're not using bindings, implement the controlTextDidChange: method in 
 the text field's delegate (if your text field doesn't have a delegate, set 
 its delegate to the appropriate controller object).

As pointed out by a sharper reader than I, these methods would change the 
behavior of these fields to always updating on each change.

If you're looking for a method that would preserve the behavior of changes only 
sent when exiting the field (tab, enter) or when the window is closed (or 
similar event),
I'd recommend the approach in the TextEdit sample's Preferences class:

https://developer.apple.com/library/mac/#samplecode/TextEdit/Listings/Preferences_m.html

Particularly, the -[Preferences windowShouldClose:] method, where you set the 
window's firstResponder to nil.


___

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

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

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

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


Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Quincey Morris
On Feb 23, 2012, at 10:27 , Markus Spoettl wrote:

 I'm using a mouse and the cursor doesn't move between -mouseMove: and 
 -mouseDown: (on screen). If the device would be capable of reporting 
 sub-pixel movements (which may not be reported by moving the cursor), I guess 
 it would have done so by sending an additional -mouseMove: event. If it 
 didn't, I have to assume it didn't notice any movement and therefore didn't 
 report any.
 
 That (maybe flawed) theory asside, I just know that it didn't move because as 
 an operator I made sure of it (when hunting a bug like this, one first 
 assumes operator mistakes, I did too).

I think the theory *is* flawed. Just because the pointer stays in the same 
place doesn't mean that a sub-pixel-resolution device didn't detect a change. 
Perhaps even the air temperature can change the reading. :)

Actually, the theory I was working on was that doing anything physical to the 
mouse, moving it or pressing on it or pressing on the surface underneath it, 
could cause the reading to change for a short period of time after the 
mouse-down was detected.

 Up until now ( Lion), it was guaranteed (well, maybe not that, it just 
 happened to work that way) that the -moveMoved: location corresponded to the 
 subsequent -mouseDown: location. That meant that any hover-effects visualized 
 during -mouseMoved: would have been rendered on objects that react in some 
 way when the mouse goes down on them.

Aha! You fell into my carefully prepared trap!

Are you talking about mouseMoved or mouseDragged?

If you're talking about mouseDragged, then the variation comes under the 
heading of debouncing the initial part of the movement, and you should 
probably be doing that anyway.

If you're talking about mouseMoved, then you already have a change of context 
involved. When the mouse is up, hover-effects should (presumably) refer to 
which object will be grabbed if you mouse down. When the mouse is down, they 
should (presumably) refer to which 2nd object the dragged object is being 
dragged to. If you're relying on mouseMoved to keep the *dragged* object 
highlighted in some way, I think you're Doing It Wrong™.


___

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

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

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

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

Re: Determining user's clock preference on iOS

2012-02-23 Thread David Duncan
On Feb 22, 2012, at 10:50 PM, Rick Mann wrote:

 Unfortunately, there's no format specifier for the hours of the day that 
 indicates use the user's preferred format.
 
 If I could determine the user's preference, then I'd just format it 
 appropriately. Alternatively, I can use the short format style, and then 
 parse out the AM/PM, but that seems more fragile across locales (are there 
 locales that use something other than am and pm?).
 
 Any suggestions?


I think this is what +[NSDateFormatter dateFormatFromTemplate:options:locale:] 
is designed to do.
--
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Dave DeLong

On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote:

 On Feb 22, 2012, at 10:50 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I have a need to format times as either
 
   24:mm
 
 or
 
   12:mm
 am
 
 That is, if the user prefers a 24-hour clock, I want it to appear on a 
 single line. If the user prefers a 12-hour clock, I want the  AM/PM 
 designator to be rendered underneath the time (in smaller type).
 
 Unfortunately, there's no format specifier for the hours of the day that 
 indicates use the user's preferred format.
 
 What happens if you give +[NSDateFormatter 
 dateFormatFromTemplate:options:locale:] a template that contains h:m:s a? 
 Does it rewrite it to H:m:s if the current locale uses 24-hour time?

If you're going to go with this route, you'd need to use j:m:s.  According to 
The Spec (http://unicode.org/reports/tr35/#Date_Format_Patterns), use of 'j' 
in a skeleton passed to an API is the only way to have a skeleton request a 
locale's preferred time cycle type (12-hour or 24-hour).

Cheers,

Dave
___

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

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

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

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Rick Mann

On Feb 23, 2012, at 11:37 , Dave DeLong wrote:

 
 On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote:
 
 On Feb 22, 2012, at 10:50 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I have a need to format times as either
 
  24:mm
 
 or
 
  12:mm
am
 
 That is, if the user prefers a 24-hour clock, I want it to appear on a 
 single line. If the user prefers a 12-hour clock, I want the  AM/PM 
 designator to be rendered underneath the time (in smaller type).
 
 Unfortunately, there's no format specifier for the hours of the day that 
 indicates use the user's preferred format.
 
 What happens if you give +[NSDateFormatter 
 dateFormatFromTemplate:options:locale:] a template that contains h:m:s a? 
 Does it rewrite it to H:m:s if the current locale uses 24-hour time?
 
 If you're going to go with this route, you'd need to use j:m:s.  According 
 to The Spec (http://unicode.org/reports/tr35/#Date_Format_Patterns), use of 
 'j' in a skeleton passed to an API is the only way to have a skeleton request 
 a locale's preferred time cycle type (12-hour or 24-hour).

Oh, perfect! I thought I knew the specifiers well, but that should do what I 
want.

-- 
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Tab view and radio buttons

2012-02-23 Thread Fritz Anderson
On 22 Feb 2012, at 2:00 PM, McLaughlin, Michael P. wrote:

 I am seeing a problem in which I select a radio button in a view, flip to 
 another tab then back again. When I do this for one of the tabbed views, the 
 just-selected radio button is not remembered.  In fact, all of them are in 
 the OFF state (which I did not think was even possible).
 
 Clearly, I have messed something up somewhere.  Could anyone tell me where to 
 start looking?
 
 The xib attribute inspector for these views has many options and I might have 
 them set some incorrectly. Documentation for many of these seems hard to find.

Do you implement the tabView:{did,should,will}SelectTabViewItem: delegate 
methods? I ask, not because I advocate doing so, but because they would be a 
possible locus of your problem.

I assume you're following the pattern of keeping the selection in a model 
object, and moderating between that and the matrix with a controller object. 
What do you see when you put a breakpoint in your method that sets the matrix 
selection?

— F


___

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

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

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

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

Re: Sudden and hard to reproduce crashes in libcache

2012-02-23 Thread Greg Parker

On Feb 21, 2012, at 6:50 AM, Dragan Milić mi...@mac.com wrote:

 First of all, I apologise if this is not the right topic for this list.
 
 Some beta testers of an application I'm working on experience rather strange 
 and sudden crashes, very often when the application is doing nothing, just 
 sitting idle in the background. The crash happens in a thread named 
 com.apple.root.default-priority and it's not even controlled by the 
 application. As far as I figure it out, it is triggered by the system to 
 release some memory from caches the application uses. This is the part of the 
 crash report related to that particular thread:
 
 Thread 8 Crashed:: Dispatch queue: com.apple.root.default-priority
 0   libsystem_kernel.dylib0x7fff8d847ce2 __pthread_kill + 10
 1   libsystem_c.dylib 0x7fff9009e7d2 pthread_kill + 95
 2   libsystem_c.dylib 0x7fff9008fa7a abort + 143
 3   libc++abi.dylib   0x7fff8a1e77bc abort_message + 214
 4   libc++abi.dylib   0x7fff8a1e4fcf default_terminate() 
 + 28
 5   libobjc.A.dylib   0x7fff8a69a1b9 _objc_terminate + 94
 6   libc++abi.dylib   0x7fff8a1e5001 
 safe_handler_caller(void (*)()) + 11
 7   libc++abi.dylib   0x7fff8a1e505c std::terminate() + 16
 8   libc++abi.dylib   0x7fff8a1e6152 __cxa_throw + 114
 9   libobjc.A.dylib   0x7fff8a699e7a objc_exception_throw 
 + 327
 10  com.apple.CoreFoundation  0x7fff8c8b92a9 -[NSException raise] 
 + 9
 11  com.apple.ExceptionHandling   0x000100332e0a 
 NSExceptionHandlerUncaughtSignalHandler + 37
 12  libsystem_c.dylib 0x7fff900f0cfa _sigtramp + 26
 13  com.apple.CoreFoundation  0x7fff8c793c0b CFRelease + 27
 14  libcache.dylib0x7fff8fb4d8e4 _value_entry_remove 
 + 142
 15  libcache.dylib0x7fff8fb4d9cd _entry_unmap + 81
 16  libcache.dylib0x7fff8fb4da71 _entry_evict + 153
 17  libcache.dylib0x7fff8fb4db04 _evict_last + 106
 18  libcache.dylib0x7fff8fb4dcf2 
 _cache_enforce_limits + 34
 19  libcache.dylib0x7fff8fb4dea5 
 cache_handle_memory_pressure + 125
 20  libdispatch.dylib 0x7fff888bf2b6 
 _dispatch_source_invoke + 635
 21  libdispatch.dylib 0x7fff888bbf77 
 _dispatch_queue_invoke + 71
 22  libdispatch.dylib 0x7fff888bb760 
 _dispatch_worker_thread2 + 198
 23  libsystem_c.dylib 0x7fff9009e3da _pthread_wqthread + 
 316
 24  libsystem_c.dylib 0x7fff9009fb85 start_wqthread + 13
 
 All those crash reports for the crashing thread look the same. Only a few 
 people experience them, but regularly. For others, it practically impossible 
 to reproduce.
 
 I'm using higher level Cocoa NSCache API to cache objects. Cached objects are 
 various image representations and much rarely attributed strings and NSNumber 
 instances. I see the crash happens after CFRelease() call, but I can't figure 
 out why. If I try to do CFRelease(NULL), I get almost the same sequence, 
 similar to:
 
 3   libc++abi.dylib   0x7fff8a1e77bc abort_message + 214
 4   libc++abi.dylib   0x7fff8a1e4fcf default_terminate() 
 + 28
 5   libobjc.A.dylib   0x7fff8a69a1b9 _objc_terminate + 94
 6   libc++abi.dylib   0x7fff8a1e5001 
 safe_handler_caller(void (*)()) + 11
 7   libc++abi.dylib   0x7fff8a1e505c std::terminate() + 16
 8   libc++abi.dylib   0x7fff8a1e6152 __cxa_throw + 114
 9   libobjc.A.dylib   0x7fff8a699e7a objc_exception_throw 
 + 327
 10  com.apple.CoreFoundation  0x7fff8c8b92a9 -[NSException raise] 
 + 9
 11  com.apple.ExceptionHandling   0x000100332e0a 
 NSExceptionHandlerUncaughtSignalHandler + 37
 12  libsystem_c.dylib 0x7fff900f0cfa _sigtramp + 26
 
 But I don't know who and why does (if at all) that NULL pointer release. The 
 documentation for libcache says Calling cache functions from cache callbacks 
 should be avoided to prevent deadlock. I thought maybe when releasing cached 
 objects libcache calls callback methods to release memory and then image 
 representations are doing some caching on their own, which would effectively 
 be calling cache functions from cache callbacks. But this is just a wild 
 guess, I've no idea what is really going on.
 
 So, I'd really appreciate if anyone can help me with this. I've got no idea 
 whether it's a but in the application, or the OS. If necessary, I can send 
 the full crash report and also explain what object are being cached using 
 NSCache.

Yep, that's CFRelease(NULL), plus ExceptionHandling.framework catching the Unix 
signal and trying to turn it 

Re: App Crashing in ARC !!

2012-02-23 Thread Fritz Anderson
On 22 Feb 2012, at 9:31 PM, Naresh Kongara wrote:

 I'm creating the alert with class method in NSAlert and running it with 
 runModal.
 
 NSAlert *alert =[NSAlert 
 alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat:];
 if ([alert runModal] == NSAlertDefaultReturn) {
 //Code
 }
 This crash is happening only after we migrated to ARC. I tried with analyzer 
 and Zombies, but no success in finding the cause for the crash.

You've provided a skeleton of how you intend to do something, but nothing that 
shows what you are actually doing. You've provided nothing more than make an 
alert and run it. If there is a bug in this section of your code, it's 
probably in the construction of the parameters to alertWith…, or in Code.

If your actual code is terribly complex, or proprietary, reduce it to a minimal 
case that reproduces it, and post it. Creating a minimal case will often show 
you your problem with no need to consult anyone else.

Also: By any chance, are you running this alert on any thread other than the 
main one? You can't do that. You'll crash.

— F


___

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

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

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

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

Re: Dumb question about radio buttons

2012-02-23 Thread Seth Willits
On Feb 23, 2012, at 5:58 AM, William Squires wrote:

  I have a custom view with an NSBox containing an NSMatrix of button cells 
 (radio buttons) When I created the NSMatrix, I told it I wanted 3 of them, 
 but in the view hierarchy, I can see the NSMatrix under the NSBox, but it has 
 4 button cells under it, not the three I asked for.

The top one is the prototype cell for the matrix. It's duplicated when new 
cells are added.



 Also, even though I set the tag for each button cell  …. 

The sender is the matrix, not the individual cell.


 Am I supposed to connect the NSMatrix to the action, and not the individual 
 cells? If so, how do I ask for the cell's tag value?


You have selectedCell to determine which radio cell is selected, and can get 
its tag from that.


--
Seth Willits



___

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

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

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

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

Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Markus Spoettl

On 23.02.12 20:07, Quincey Morris wrote:

Up until now ( Lion), it was guaranteed (well, maybe not that, it
just happened to work that way) that the -moveMoved: location
corresponded to the subsequent -mouseDown: location. That meant that
any hover-effects visualized during -mouseMoved: would have been
rendered on objects that react in some way when the mouse goes down on
them.


Aha! You fell into my carefully prepared trap!

[...]

If you're talking about mouseMoved, then you already have a change of
context involved. When the mouse is up, hover-effects should
(presumably) refer to which object will be grabbed if you mouse down.
When the mouse is down, they should (presumably) refer to which 2nd
object the dragged object is being dragged to. If you're relying on
mouseMoved to keep the *dragged* object highlighted in some way, I think
you're Doing It Wrong™.


It's not what I'm doing. This is what I do:

1) On -mouseMoved: locate object under the cursor and highlight it so 
the user knows which one of them will be operated on when the mouse goes 
down.


2) On -mouseDown: locate object under the cursor and prepare it for 
dragging (by remembering it).


3) On -mouseDragged: drag the object selected in (2)

Pretty standard stuff. Of course this relies on steps (1) and (2) 
locating the same object.


Apparently one can't assume (1) and (2) produce the same coordinates, 
although I think that's a bug or at least it's unclear what the 
relationship of coordinates between mouseMoved: and mouseDown: is.


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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

Re: Loading existing NIB file from Cocoa?

2012-02-23 Thread Seth Willits
On Feb 23, 2012, at 8:49 AM, Howard Moon wrote:

 I'm not sure how to proceed here.  Is it possible to modify my .nib file in 
 some manner so that it works in Cocoa (and still works in Carbon)?  Or, do I 
 have to make a new .xib for use with Cocoa, essentially doubling the work and 
 resources in order to support both types?

Carbon and Cocoa nibs are not at all compatible. You will need to create a new 
nib for Cocoa.


--
Seth Willits

___

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

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

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

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


Re: Was: Re: NSStepper - useless?

2012-02-23 Thread Seth Willits
On Feb 23, 2012, at 6:16 AM, William Squires wrote:

 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind!

It's pretty irrelevant, because you wouldn't be using a stepper control for 
values in the billions. That'd be a poor UI. Just like if a table view had a 
couple billion rows in it in (in 32-bit) it would have broken as well. But it's 
a terrible thing to do in the first place. ;)


 Why didn't they just make the NSStepper a custom view that draws two arrows, 
 and has two sent actions that you can connect? Or even a variation of 
 NSMatrix with two button cells that look like arrows. That would avoid the 
 problem entirely, and be more intuitive to use.

Not really. The control's intended use is to increment and decrement a value. 
That's what it does. If you're not using the stepper for manipulating a numeric 
value, you should probably be using a different control.


--
Seth Willits


___

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

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

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

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


Re: Loading existing NIB file from Cocoa?

2012-02-23 Thread Kyle Sluder
On Thu, Feb 23, 2012 at 8:49 AM, Howard Moon how...@antarestech.com wrote:
 HI all,

        I've got an audio plug-in that supports Windows and Carbon, and is 
 being updated to support Cocoa (when the audio host is Cocoa-based).  On the 
 Carbon side of things, I've got a .nib file that contains a few dialogs that 
 I need to present to users, and I'm wondering if and how I can use this older 
 .nib file in Cocoa.  When I try to load the nib using NSBundle loadNibNamed:, 
 I get the following error:

 Unable to load the Interface Builder file xx.nib because the 
 object archive is missing. Valid nib files must contain either 
 keyedobjects.nib, objects.nib, or data.nib.

        I'm not sure how to proceed here.  Is it possible to modify my .nib 
 file in some manner so that it works in Cocoa (and still works in Carbon)?  
 Or, do I have to make a new .xib for use with Cocoa, essentially doubling the 
 work and resources in order to support both types?

No, they're completely different. You will need to recreate your
interface in a Cocoa nib. You should also consider removing or at
least deprecating your Carbon 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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)

2012-02-23 Thread Antonio Nunes
I have a few popovers that, as far as I'm aware of, were working fine up to 
10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it 
often disappears, whether the click is on the background or on a UI item. I 
haven't figured out the trick exactly of the way in which clicking makes the 
popover go away, but it appears to be sensitive to how you click. A popover 
should never go away though when it is clicked upon. I think this is a bug in 
10.7.3. Various internet searches for this issue did not return any results, 
nor did searching Apple's developer forums.

Any ideas what might be causing this, or how to work around the issue? Has 
anyone else even encountered this issue?

-António

-
Accepting others as they are
brings a wonderful freedom
to your own mind.

--The Peace Formula
-





___

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

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

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

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

Re: Loading existing NIB file from Cocoa?

2012-02-23 Thread Howard Moon
 Oh well, thanks, guys!

-Howard

On Feb 23, 2012, at 12:11 PM, Seth Willits wrote:

 On Feb 23, 2012, at 8:49 AM, Howard Moon wrote:
 
 I'm not sure how to proceed here.  Is it possible to modify my .nib file in 
 some manner so that it works in Cocoa (and still works in Carbon)?  Or, do I 
 have to make a new .xib for use with Cocoa, essentially doubling the work 
 and resources in order to support both types?
 
 Carbon and Cocoa nibs are not at all compatible. You will need to create a 
 new nib for Cocoa.
 
 
 --
 Seth Willits


___

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

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

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

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


Re: ImageCapture + ImageKit problem...

2012-02-23 Thread Fritz Anderson
On 23 Feb 2012, at 2:12 AM, Eric Matecki wrote:

 Oh, something that may be part of the problem (or of the solution...):
 
 I don't call run on my app for multiplatform portability reasons.
 Instead I call this in a customized event loop:

Alas, you are writing an application for Mac OS X. Cocoa's event loop handler 
is probably more than two lines long, and ImageCapture/ImageKit may depend on 
things your event loop does not do.

Narrow your problem down by seeing whether your app works when run as an 
application. 

— F


___

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

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

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

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

Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Quincey Morris
On Feb 23, 2012, at 12:09 , Markus Spoettl wrote:

 This is what I do:
 
 1) On -mouseMoved: locate object under the cursor and highlight it so the 
 user knows which one of them will be operated on when the mouse goes down.
 
 2) On -mouseDown: locate object under the cursor and prepare it for dragging 
 (by remembering it).
 
 3) On -mouseDragged: drag the object selected in (2)
 
 Pretty standard stuff. Of course this relies on steps (1) and (2) locating 
 the same object.
 
 Apparently one can't assume (1) and (2) produce the same coordinates, 
 although I think that's a bug or at least it's unclear what the relationship 
 of coordinates between mouseMoved: and mouseDown: is.

Ah, it's clear now. But I still think your theory is flawed. You can't assume 
that the physical act of pressing the mouse button doesn't change the reading 
(that is, doesn't possibly move the mouse slightly). I don't think that the 
rounding in mouseDown has anything to do with it. All we know is that 
currently, the mouse can move during the act of pressing down without producing 
a new mouseMoved, whereas previously it didn't behave like that -- or, not 
often enough to notice.

Incidentally, I have some event-related code that's evolved for years over a 
series of different apps, and I noticed recently that in its last evolution a 
couple of years ago, I apparently arranged for all of the common events 
(mouseEntered, mouseExited, mouseMoved, mouseDown, mouseUp, mouseDragged, 
keyDown and keyUp) to always call cursorUpdate before doing whatever else they 
do. That allowed me to consolidate the hover-highlight-detection in one place 
(cursorUpdate), and gave consistency to the highlighting in cases exactly like 
the one you're describing.

I mention this approach because I worried that (a) calling cursorUpdate 
additional times might be a performance problem [it isn't, not in any case I've 
noticed] and (b) there might be a problem passing the event object from a 
different event to the cursorUpdate method [there isn't, that I can tell].

Maybe you can give this approach a try. It means you don't have to keep any 
additional state, which was a concern you mentioned earlier.


___

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

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

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

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Rick Mann

On Feb 23, 2012, at 11:37 , Dave DeLong wrote:

 
 On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote:
 
 What happens if you give +[NSDateFormatter 
 dateFormatFromTemplate:options:locale:] a template that contains h:m:s a? 
 Does it rewrite it to H:m:s if the current locale uses 24-hour time?
 
 If you're going to go with this route, you'd need to use j:m:s.  According 
 to The Spec (http://unicode.org/reports/tr35/#Date_Format_Patterns), use of 
 'j' in a skeleton passed to an API is the only way to have a skeleton request 
 a locale's preferred time cycle type (12-hour or 24-hour).

So, I tried using a dateFormat of @j:mm and got nothing but : in the 
result. I tried passing @j:mm to -dateFormatFromTemplate:options:locale:, but 
the result is always HH:mm, even when I have things set to 12-hour.

It seems that iOS does not properly honor j (behavior is the same on device 
and sim, but on the sim I can't set the format).

-- 
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Rick Mann
Oh, j works on iOS if you pass it to -dateFormatFromTemplate:options:locale:, 
but only if you pass [NSLocale currentLocale] and not nil.

On Mac OS X, the 12/24-hour format in the Clock is different than in the 
International settings. Changing the clock has no effect, but I haven't 
verified that changing the time format does.

-- 
Rick

On Feb 23, 2012, at 11:37 , Dave DeLong wrote:

 
 On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote:
 
 On Feb 22, 2012, at 10:50 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I have a need to format times as either
 
  24:mm
 
 or
 
  12:mm
am
 
 That is, if the user prefers a 24-hour clock, I want it to appear on a 
 single line. If the user prefers a 12-hour clock, I want the  AM/PM 
 designator to be rendered underneath the time (in smaller type).
 
 Unfortunately, there's no format specifier for the hours of the day that 
 indicates use the user's preferred format.
 
 What happens if you give +[NSDateFormatter 
 dateFormatFromTemplate:options:locale:] a template that contains h:m:s a? 
 Does it rewrite it to H:m:s if the current locale uses 24-hour time?
 
 If you're going to go with this route, you'd need to use j:m:s.  According 
 to The Spec (http://unicode.org/reports/tr35/#Date_Format_Patterns), use of 
 'j' in a skeleton passed to an API is the only way to have a skeleton request 
 a locale's preferred time cycle type (12-hour or 24-hour).
 
 Cheers,
 
 Dave


___

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

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

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

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


Re: Semi-Transient NSPopover disappearing when it shouldn't (10.7.3)

2012-02-23 Thread Seth Willits
On Feb 23, 2012, at 9:28 AM, Antonio Nunes wrote:

 I have a few popovers that, as far as I'm aware of, were working fine up to 
 10.7.2. Now, in 10.7.3, when the popover appears, if a user clicks on it, it 
 often disappears, whether the click is on the background or on a UI item.

Can you replicate this in a test project?


--
Seth Willits



___

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

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

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

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Rick Mann
A little more info. @j:m gets written to h:mm a, which is unfortunate. It 
always adds the a. 

On Feb 23, 2012, at 11:37 , Dave DeLong wrote:

 
 On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote:
 
 On Feb 22, 2012, at 10:50 PM, Rick Mann rm...@latencyzero.com wrote:
 
 I have a need to format times as either
 
  24:mm
 
 or
 
  12:mm
am
 
 That is, if the user prefers a 24-hour clock, I want it to appear on a 
 single line. If the user prefers a 12-hour clock, I want the  AM/PM 
 designator to be rendered underneath the time (in smaller type).
 
 Unfortunately, there's no format specifier for the hours of the day that 
 indicates use the user's preferred format.
 
 What happens if you give +[NSDateFormatter 
 dateFormatFromTemplate:options:locale:] a template that contains h:m:s a? 
 Does it rewrite it to H:m:s if the current locale uses 24-hour time?
 
 If you're going to go with this route, you'd need to use j:m:s.  According 
 to The Spec (http://unicode.org/reports/tr35/#Date_Format_Patterns), use of 
 'j' in a skeleton passed to an API is the only way to have a skeleton request 
 a locale's preferred time cycle type (12-hour or 24-hour).
 
 Cheers,
 
 Dave


___

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

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

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

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


Re: Dumb question about radio buttons

2012-02-23 Thread Keary Suska
On Feb 23, 2012, at 6:58 AM, William Squires wrote:

  I have a custom view with an NSBox containing an NSMatrix of button cells 
 (radio buttons) When I created the NSMatrix, I told it I wanted 3 of them, 
 but in the view hierarchy, I can see the NSMatrix under the NSBox, but it has 
 4 button cells under it, not the three I asked for - Is this an Xcode/IB 
 screw-up, or do NSMatrix's always add one extra element when making a group 
 of radio buttons? Should I delete the matrix and try again? When I vertically 
 resize the matrix, I always see three cells, so I don't think there's one 
 hidden under there.

The third (usually first in the list, however) cell is the cell prototype, as 
every NSMatrix needs a cell prototype. 

  Also, even though I set the tag for each button cell (the top one is 0, the 
 next one down is 1, etc...), when I connect them to my
 
 -(IBAction)baseChanged:(id)sender
 {
 int choice = [sender tag];
 switch (choice)
  {
  case 0: // number base is 16 - hexadecimal
  NSLog(@user chose hexadecimal);
  ...
  break;
 
  case 1: // number base is 2 - binary
  NSLog(@user chose binary);
  ...
  break;
 
  case 2: // number base is 10 - decimal
  NSLog(@user chose decimal);
  ...
  break;
  }
 self.numberBase = choice;
 }
 
 I always get, user chose hexadecimal! :( (all the buttons generate an 
 action, so it's not that...)

Is it not? Have you inspected what the sender object truly is? Maybe it is the 
matrix, and not the cell?

  Am I supposed to connect the NSMatrix to the action, and not the individual 
 cells? If so, how do I ask for the cell's tag value?

Considering that the sender is the NSMatrix: [[sender selectedCell] tag]

HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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

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

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

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


Re: Was: Re: NSStepper - useless?

2012-02-23 Thread Keary Suska
On Feb 23, 2012, at 10:05 AM, Kyle Sluder wrote:

 On Thu, Feb 23, 2012 at 6:16 AM, William Squires wsqui...@satx.rr.com wrote:
 From what I've read, the NSStepper has a bug (though practically, you'll 
 never see it); if one were to click the up or down arrow on the control 2^32 
 times (assuming it's value is a 4-byte signed int,and is initialized to 0), 
 it would wrap around (or raise an exception for integer overflow). Probably 
 not what the user had in mind! Why didn't they just make the NSStepper a 
 custom view that draws two arrows, and has two sent actions that you can 
 connect? Or even a variation of NSMatrix with two button cells that look 
 like arrows. That would avoid the problem entirely, and be more intuitive to 
 use.
 
 Because NSStepper is over 20 years old, dating back to when the way to
 push values around was to wire up a control's action to another
 control's -takeValueFrom: method. Besides, all sorts of crazy things
 tend to happen anyway when you try to use UINT_MAX for anything
 useful.


Not to mention that this is really a programmer error. If you don't wan the 
value to overflow, set a sensible maximum. A similar issue could happen from 
any user-entry field. It's the developer's responsibility (IMHO) to set data 
entry constraints.

Best,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business


___

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

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

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

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


Re: Dumb question about radio buttons

2012-02-23 Thread Graham Cox

On 24/02/2012, at 12:58 AM, William Squires wrote:

  I have a custom view with an NSBox containing an NSMatrix of button cells 
 (radio buttons) When I created the NSMatrix, I told it I wanted 3 of them, 
 but in the view hierarchy, I can see the NSMatrix under the NSBox, but it has 
 4 button cells under it, not the three I asked for - Is this an Xcode/IB 
 screw-up, or do NSMatrix's always add one extra element when making a group 
 of radio buttons? Should I delete the matrix and try again? When I vertically 
 resize the matrix, I always see three cells, so I don't think there's one 
 hidden under there.
  Also, even though I set the tag for each button cell (the top one is 0, the 
 next one down is 1, etc...), when I connect them to my
 
 -(IBAction)baseChanged:(id)sender
 {
 int choice = [sender tag];
 switch (choice)
  {
  case 0: // number base is 16 - hexadecimal
  NSLog(@user chose hexadecimal);
  ...
  break;
 
  case 1: // number base is 2 - binary
  NSLog(@user chose binary);
  ...
  break;
 
  case 2: // number base is 10 - decimal
  NSLog(@user chose decimal);
  ...
  break;
  }
 self.numberBase = choice;
 }
 
 I always get, user chose hexadecimal! :( (all the buttons generate an 
 action, so it's not that...)
  Am I supposed to connect the NSMatrix to the action, and not the individual 
 cells? If so, how do I ask for the cell's tag value?


I'm not sure why you're getting 1 more than you apparently asked for - it 
should be the number, no more. 

To set the tag for each cell in the matrix, you need to go through them in IB 
and set the tag, they are not automatically inserted, and all default to zero. 
I usually set the target/action of the entire matrix and use the tag of the 
cell to determine which cell was selected. So, instead of [sender tag], I use 
[[sender selectedCell] tag].

Also, it doesn't matter much here, but you really should be using type 
NSInteger instead of int everywhere.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Determining user's clock preference on iOS

2012-02-23 Thread Kyle Sluder
On Thu, Feb 23, 2012 at 2:01 PM, Rick Mann rm...@latencyzero.com wrote:
 A little more info. @j:m gets written to h:mm a, which is unfortunate. It 
 always adds the a.

Hmm, the documentation seems to imply that iOS might do the right
thing here, and choose the final output format based on the user's
preference: 
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DataFormatting/Articles/dfDateFormatting10_4.html

Which is terrible, of course. If the programmer specifies they want a
12-hour + am/pm format, they should get it. There is already an API to
transform that into a localized variant.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSView mouseDown truncated coordinates

2012-02-23 Thread Markus Spoettl

On 23.02.12 21:55, Quincey Morris wrote:

Ah, it's clear now. But I still think your theory is flawed. You can't
assume that the physical act of pressing the mouse button doesn't change
the reading (that is, doesn't possibly move the mouse slightly). I don't
think that the rounding in mouseDown has anything to do with it. All we
know is that currently, the mouse can move during the act of pressing
down without producing a new mouseMoved, whereas previously it didn't
behave like that -- or, not often enough to notice.


I agree, but...


Incidentally, I have some event-related code that's evolved for years
over a series of different apps, and I noticed recently that in its last
evolution a couple of years ago, I apparently arranged for all of the
common events (mouseEntered, mouseExited, mouseMoved, mouseDown,
mouseUp, mouseDragged, keyDown and keyUp) to always call cursorUpdate
before doing whatever else they do. That allowed me to consolidate the
hover-highlight-detection in one place (cursorUpdate), and gave
consistency to the highlighting in cases exactly like the one you're
describing.


I think I do exactly the same thing, unless I missunderstand what 
cursorUpdate does for you, namely (1) detect which item to highlight, 
(2) which to lowlight, (3) which to leave alone and (4) do all that. All 
in a central place.


Mouse movement highlighting must happen when the mouse moves. At that 
time, only the mouse move coordinates are known. They correspond with 
what happens on the screen, so highlighting works as expected.


Now a mouse-down comes along with different coordinates. That change in 
coordinates is not reflected visually on screen (no cursor movement, no 
highlight changes). It leads to other objects than the one highlighted 
one being manipulated. Really confusing to the end user.


Regards
Markus

PS: None of your or my replies seem to make it through to the list 
although both you an I cc the list. Not sure why that is.

--
__
Markus Spoettl
___

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

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

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

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


Re: Loading existing NIB file from Cocoa?

2012-02-23 Thread Fritz Anderson
On 23 Feb 2012, at 10:49 AM, Howard Moon wrote:

 Unable to load the Interface Builder file xx.nib because the 
 object archive is missing. Valid nib files must contain either 
 keyedobjects.nib, objects.nib, or data.nib.
 
   I'm not sure how to proceed here.  Is it possible to modify my .nib 
 file in some manner so that it works in Cocoa (and still works in Carbon)?  
 Or, do I have to make a new .xib for use with Cocoa, essentially doubling the 
 work and resources in order to support both types?

As the error message says (or at least implies), Cocoa NIBs are archives of 
Objective-C objects, not just shareable specs. They are nothing like Carbon 
NIBs; you have to maintain them separately.

Carbon has had curtailed utility for the last three major versions of the OS — 
nearly five years now. I hear (from Wikipedia) that it's officially deprecated 
in Mountain Lion, so I guess you'll start seeing compiler warnings later this 
year. You know best, but do you really have to support Carbon any more?

— F


___

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

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

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

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