WindowID to front

2011-02-27 Thread Benedikt Iltisberger
Hello everybody,

I read tons of information on how to set and get the PID but i need a way to 
set a window to front (and not a window of a PID).
The problem is that if I set a PID to front, it might not be the exact window i 
want because the process can have multiple windows.

With help of the CGWindowListCopyWindowInfo I can get all window IDs and filter 
out the needed one.

But how can I now set the selected window ID to front?

(Note: It is a window of a foreign application which I want to set to front. My 
own app wouldn't be a problem.)

It would be very glad if somebody has a advise for me.

Thanks in advance.

Cheers
Benedikt___

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

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

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

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


Re: MPVolumeView

2011-02-27 Thread David Rowland
Well, fan my brow, so it does. Except it is very erratic. Only about a third of 
the time does it respond. Also, I would like it to jump on touchdown, not 
touchup.


D


On Feb 27, 2011, at 12:19 PM, Matt Neuburg wrote:

> On Sun, 27 Feb 2011 09:58:03 -0800, David Rowland  
> said:
>> I want it to behave like a slider, but I want it to jump to the setting I 
>> touch rather than requiring me to "capture" the button before I can move it.
> 
> On my device, an MPVolumeView behaves in just that way - you can tap to make 
> the button jump to where you tapped. m.
> 
> --
> matt neuburg, phd = m...@tidbits.com, 
> A fool + a tool + an autorelease pool = cool!
> AppleScript: the Definitive Guide - Second Edition!
> http://www.apeth.net/matt/default.html#applescriptthings

___

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

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

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

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


Re: "context-aware" bindings

2011-02-27 Thread Charles Srstka
On Feb 27, 2011, at 9:25 AM, Mikkel Eide Eriksen wrote:

> 
> On 27/02/2011, at 11.39, Joanna Carter wrote:
> 
>> Le 27 févr. 2011 à 10:07, Andy Lee a écrit :
>> 
>>> On Feb 27, 2011, at 3:19 AM, Mikkel Eide Eriksen wrote:
 I have a property on an object that would ideally return either its value 
 or nil, depending on the context it's being called from.
>>> 
>>> Can you tell us the name of the object and the property, and describe the 
>>> different contexts? I'm having trouble imagining such a requirement.
>>> 
 I could do this with multiple selectors, but was wondering if there was a 
 "cleaner" way of determining how it is being called.
>>> 
>>> It seems to me a property that can return multiple values isn't really a 
>>> property. It's either a method you pass a parameter to (to specify 
>>> "context" -- which of course won't work for bindings), or it's multiple 
>>> properties (i.e., multiple selectors -- what's not clean about that?).
>> 
>> There is certainly a design problem here. Why would two different callers 
>> expect a different result from a property, when one of those results is 
>> going to be nil?
>> 
>> If one of the callers is expecting nil returned, why bother calling the 
>> property?
>> 
>> Some idea of the code would be useful.
> 
> It would only return nil in some cases. I'm working on some Gedcom <-> Core 
> Data code. All objects in Gedcom have a "tag" identifier. One such object is 
> an "Event", with the generic tag EVEN. There are multiple subtypes of Event, 
> such as BIRT (birth), DEAT (death), CONF (confirmation), etc.
> 
> An Event can also have a "type", which in the case of generic EVENs is 
> something for which no specific tag exists. So:
> 
> Event with type "Birth" should become:
> 1 BIRT
> 2 DATE ...
> 2 PLAC ...
> 
> generic Event with some type should become:
> 1 EVEN
> 2 TYPE Event Type
> 2 DATE ...
> 2 PLAC ...
> 
> My current implementation of the type getter on the Event object checks to 
> see if the type is one of the known tags (Birth, etc), and returns nil so as 
> to avoid redundant data:
> 
> 1 BIRT
> 2 TYPE Birth
> 2 DATE ...
> 2 PLAC ...
> 
> I think I'll probably use a displayType property for bindings, and the 
> internal type property for writing out to Gedcom. Another option would be to 
> subclass Event into all the different types, but that seems overkill.

This sounds like a job for a NSValueTransformer subclass, really. I think that 
should be able to do exactly what you want.

Charles___

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

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

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

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


Accessibility in custom NSControl subclasses

2011-02-27 Thread Stephen Blinkhorn

Hello,

I make extensive use of custom NSControls in some of my GUIs. Recently  
I ran into a problem whilst trying to implement accessibility features  
in these controls.


I have added the test methods below which work perfectly for custom  
NSView classes but are not working as expected with custom NSControl  
classes. With custom NSControl classes voice over reads out the  
application name instead of value, role and description details.


Can anyone shed any light on why this is happening? Maybe it is worth  
mentioning that none of my controls use NSCell classes at this time.



-(BOOL)accessibilityIsIgnored {
return NO;
}

-(NSArray*)accessibilityAttributeNames
{
NSArray* attributes = [super accessibilityAttributeNames];
	NSMutableArray* mutable_attributes = [[NSMutableArray alloc]  
initWithCapacity:[attributes count]];

[mutable_attributes addObjectsFromArray:attributes];
[mutable_attributes addObject:NSAccessibilityValueAttribute];
	[mutable_attributes  
addObject:NSAccessibilityValueDescriptionAttribute];

return (NSArray*)mutable_attributes;
}

-(id)accessibilityAttributeValue:(NSString *)attribute
{
if([attribute isEqualToString:NSAccessibilityRoleAttribute]) {
return NSAccessibilitySliderRole;
} else if([attribute  
isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {

return NSAccessibilityRoleDescriptionForUIElement(self);
} else if([attribute isEqualToString:NSAccessibilityValueAttribute]) {
return [NSNumber numberWithFloat:50.0];
	} else if([attribute  
isEqualToString:NSAccessibilityValueDescriptionAttribute]) {

return @"50%";
} else {
return [super accessibilityAttributeValue:attribute];
};
}

Thanks,
Stephen
___

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

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

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

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


Re: NSNumberFormatter scientific notation and fraction digits

2011-02-27 Thread Quincey Morris
On Feb 27, 2011, at 13:42, jonat...@mugginsoft.com wrote:

> [self.formatter setMaximumFractionDigits:3];
> [self.formatter setMinimumFractionDigits:3];

The documentation describes these as affecting "input" to the number formatter, 
which presumably means strings being interpreted as numbers, and not numbers 
being formatted as strings.

> I also tried call -setMaximumSignificantDigits:4 but this did not seem to 
> improve the situation. 

This one does seem to be for output, not input. Did you also 
'setUsesSignificantDigits:YES'? It looks like that's necessary.


___

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

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

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

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


NSNumberFormatter scientific notation and fraction digits

2011-02-27 Thread jonat...@mugginsoft.com
I have an NSNumberFormatter attached to an NStextField that I switch between 
decimal and scientific notation like so: 
(The use of -setNumberStyle is encouraged in the documents)

[self.formatter setNumberStyle:NSNumberFormatterScientificStyle];
or
[self.formatter setNumberStyle:NSNumberFormatterDecimalStyle];

I then configure decimal places:
[self.formatter setMaximumFractionDigits:3];
[self.formatter setMinimumFractionDigits:3];

When the style is decimal formatting occurs as I would anticipate, so if I 
enter 1.1234 the value is formatted to 1.123 .
With the scientific style selected I find that an input of 1.1234e0 is 
formatted as 1.120e0, as is an input of 1.123e0.
ie: the least significant digit is always 0.
This is not what I expect, but my expectations may be off the mark here.

I also tried call -setMaximumSignificantDigits:4 but this did not seem to 
improve the situation. 

Any ideas?

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.com







___

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

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

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

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


Re: iPad widget question

2011-02-27 Thread Matt Neuburg
On Sat, 26 Feb 2011 19:37:28 -0800, Lightning Duck  said:
>And now I realize NSCollectionView is for Mac, not for iPad and the AQGridView 
>works for the iPad

Though really it's not hard to lay out the grid yourself. Take a look at my 
LinkSame game (free); it's basically just a grid of tappable icons. No 
third-party code needed. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

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

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

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

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


Re: MPVolumeView

2011-02-27 Thread Matt Neuburg
On Sun, 27 Feb 2011 09:58:03 -0800, David Rowland  said:
> I want it to behave like a slider, but I want it to jump to the setting I 
> touch rather than requiring me to "capture" the button before I can move it.

On my device, an MPVolumeView behaves in just that way - you can tap to make 
the button jump to where you tapped. m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings___

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

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

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

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


Re: MPVolumeView

2011-02-27 Thread David Rowland
Thanks for responding, but I think the answer is no.

It works like this: system volume stands in front of every sound output (except 
the ringer). If SysVol is set to 0, no output will be heard. Nothing in Core 
Audio can override that. If I am wrong I would love to hear about it, but that 
is my understanding.

It's an interface decision, no app should be able to override the user's 
setting. The user can use Settings or the external buttons. In addition, the OS 
provides MPVolumeView for use within an app.

I can use that, but I have a specific idea of how I want it to look and work. 
Since MPVolumeView inherits from UIView, I can intercept some methods and bend 
them to my will, but the OS doesn't give me access to the control-like elements 
of MPVolumeView. I want it to behave like a slider, but I want it to jump to 
the setting I touch rather than requiring me to "capture" the button before I 
can move it.

David





On Feb 27, 2011, at 1:29 AM, Laurent Cerveau wrote:

> Can't you just do what you want using directly CoreAudio?
> 
> laurent
> 
> On Feb 27, 2011, at 12:08 AM, David Rowland wrote:
> 
>> Apple seems to have made it impossible for an app to control the system 
>> volume. The user can use the physical buttons, and an app can contain an 
>> MPVolumeView which lets the user control the volume, but there is no 
>> programmed access to that setting. 
>> 
>> I want a volume control that looks and behaves differently from 
>> MPVolumeView. I think I know how to adapt it to do what I need except this 
>> -- when I touch the control I want it to go to that setting. In other words, 
>> I don't want to have to find the slider button first and then move it, just 
>> jump to the spot I have touched.
>> 
>> Anyone have a suggestion?
>> 
>> thanks,
>> 
>> David
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/lcerveau%40me.com
>> 
>> This email sent to lcerv...@me.com
> 

___

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

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

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

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


Stack+Overflow+Question

2011-02-27 Thread Max Stottrop
Change+UITextfield+on+a+detailview+by+clicking+on+different+Cells
http://stackoverflow.com/q/5134693/623784

Every help appreciated. I'm kinda noob, so forgice me if the answer is 
simple;)___

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

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

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

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


Re: "context-aware" bindings

2011-02-27 Thread Mikkel Eide Eriksen
On 27/02/2011, at 17.19, Joanna Carter wrote:
> Le 27 févr. 2011 à 15:25, Mikkel Eide Eriksen a écrit :
>> It would only return nil in some cases. I'm working on some Gedcom <-> Core 
>> Data code. All objects in Gedcom have a "tag" identifier. One such object is 
>> an "Event", with the generic tag EVEN. There are multiple subtypes of Event, 
>> such as BIRT (birth), DEAT (death), CONF (confirmation), etc.
>> 
>> An Event can also have a "type", which in the case of generic EVENs is 
>> something for which no specific tag exists. So:
>> 
>> Event with type "Birth" should become:
>> 1 BIRT
>> 2 DATE ...
>> 2 PLAC ...
>> 
>> generic Event with some type should become:
>> 1 EVEN
>> 2 TYPE Event Type
>> 2 DATE ...
>> 2 PLAC ...
>> 
>> My current implementation of the type getter on the Event object checks to 
>> see if the type is one of the known tags (Birth, etc), and returns nil so as 
>> to avoid redundant data:
>> 
>> 1 BIRT
>> 2 TYPE Birth
>> 2 DATE ...
>> 2 PLAC ...
>> 
>> I think I'll probably use a displayType property for bindings, and the 
>> internal type property for writing out to Gedcom. Another option would be to 
>> subclass Event into all the different types, but that seems overkill.
> 
> If you are displaying the event's "tag", then all you need is to return the 
> appropriate string; the event getter can check what to return.
> 
> But, if you are transforming to/from an event from/to something else that 
> should contain the tag value, then what about using a variation of the 
> Visitor design pattern?
> 
> Are you creating something from the event, or an event from something else? 
> Can you let us see an idea of the two classes involved?


I do both. I create the event from gedcom data, and create gedcom data from the 
event. 

http://code.google.com/p/cocoa-gedcom/wiki/Design

The "type" code in question is below:

http://code.google.com/p/cocoa-gedcom/source/browse/trunk/GCCoreData/src/GCEvent.m#247

When creating gedcom data, it is accessed via GCEvents superclass GCObject:

http://code.google.com/p/cocoa-gedcom/source/browse/trunk/GCCoreData/src/GCObject.m#380

Since the tagDict is built dynamically at runtime, I should mention it looks 
like this:

{
key = type;
tag = TYPE;
type = attribute;
}

Which means the actual part of gedcomNode that executes is lines 411+. Note 
that almost all attributes are simply written out as-is, it's only for the 
specific case of an Event which has a type that means the same thing as its tag 
that I don't want the value.

I just now added a displayType, and this works (I can show "Birth" in the GUI 
and nothing in the Gedcom data), but as I mentioned it doesn't seem so clean to 
have two ways of accessing the same primitiveType.

Regards,
Mikkel

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: "context-aware" bindings

2011-02-27 Thread Joanna Carter
Le 27 févr. 2011 à 15:25, Mikkel Eide Eriksen a écrit :

> It would only return nil in some cases. I'm working on some Gedcom <-> Core 
> Data code. All objects in Gedcom have a "tag" identifier. One such object is 
> an "Event", with the generic tag EVEN. There are multiple subtypes of Event, 
> such as BIRT (birth), DEAT (death), CONF (confirmation), etc.
> 
> An Event can also have a "type", which in the case of generic EVENs is 
> something for which no specific tag exists. So:
> 
> Event with type "Birth" should become:
> 1 BIRT
> 2 DATE ...
> 2 PLAC ...
> 
> generic Event with some type should become:
> 1 EVEN
> 2 TYPE Event Type
> 2 DATE ...
> 2 PLAC ...
> 
> My current implementation of the type getter on the Event object checks to 
> see if the type is one of the known tags (Birth, etc), and returns nil so as 
> to avoid redundant data:
> 
> 1 BIRT
> 2 TYPE Birth
> 2 DATE ...
> 2 PLAC ...
> 
> I think I'll probably use a displayType property for bindings, and the 
> internal type property for writing out to Gedcom. Another option would be to 
> subclass Event into all the different types, but that seems overkill.

If you are displaying the event's "tag", then all you need is to return the 
appropriate string; the event getter can check what to return.

But, if you are transforming to/from an event from/to something else that 
should contain the tag value, then what about using a variation of the Visitor 
design pattern?

Are you creating something from the event, or an event from something else? Can 
you let us see an idea of the two classes involved?

Joanna

--
Joanna Carter
Carter Consulting

___

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

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

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

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


Re: "context-aware" bindings

2011-02-27 Thread Mikkel Eide Eriksen

On 27/02/2011, at 11.39, Joanna Carter wrote:

> Le 27 févr. 2011 à 10:07, Andy Lee a écrit :
> 
>> On Feb 27, 2011, at 3:19 AM, Mikkel Eide Eriksen wrote:
>>> I have a property on an object that would ideally return either its value 
>>> or nil, depending on the context it's being called from.
>> 
>> Can you tell us the name of the object and the property, and describe the 
>> different contexts? I'm having trouble imagining such a requirement.
>> 
>>> I could do this with multiple selectors, but was wondering if there was a 
>>> "cleaner" way of determining how it is being called.
>> 
>> It seems to me a property that can return multiple values isn't really a 
>> property. It's either a method you pass a parameter to (to specify "context" 
>> -- which of course won't work for bindings), or it's multiple properties 
>> (i.e., multiple selectors -- what's not clean about that?).
> 
> There is certainly a design problem here. Why would two different callers 
> expect a different result from a property, when one of those results is going 
> to be nil?
> 
> If one of the callers is expecting nil returned, why bother calling the 
> property?
> 
> Some idea of the code would be useful.

It would only return nil in some cases. I'm working on some Gedcom <-> Core 
Data code. All objects in Gedcom have a "tag" identifier. One such object is an 
"Event", with the generic tag EVEN. There are multiple subtypes of Event, such 
as BIRT (birth), DEAT (death), CONF (confirmation), etc.

An Event can also have a "type", which in the case of generic EVENs is 
something for which no specific tag exists. So:

Event with type "Birth" should become:
1 BIRT
2 DATE ...
2 PLAC ...

generic Event with some type should become:
1 EVEN
2 TYPE Event Type
2 DATE ...
2 PLAC ...

My current implementation of the type getter on the Event object checks to see 
if the type is one of the known tags (Birth, etc), and returns nil so as to 
avoid redundant data:

1 BIRT
2 TYPE Birth
2 DATE ...
2 PLAC ...

I think I'll probably use a displayType property for bindings, and the internal 
type property for writing out to Gedcom. Another option would be to subclass 
Event into all the different types, but that seems overkill.

Regards,
Mikkel





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: First Responder

2011-02-27 Thread Gerriet M. Denkmann

On 27 Feb 2011, at 19:33, Graham Cox  wrote:

> 
> On 26/02/2011, at 6:19 PM, koko wrote:
> 
>> Did you know that the average vocabulary is less that 200 words? And I be 
>> penchant is not in that set.
> 
> There are almost 1 million distinct words in English. 

"The Global Language Monitor announced that the English language had crossed 
the 1,000,000-word threshold on June 10, 2009.[79] The announcement was met 
with strong scepticism by linguists and lexicographers,[80] though a number of 
non-specialist reports[81][82] accepted the figure uncritically." 
See: 

"The Second Edition of the 20-volume  Oxford English Dictionary contains full 
entries for 171,476 words in current use, and 47,156 obsolete words." 
See: 

Kind regards,

Gerriet.

___

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

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

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

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


Re: NSWindowController

2011-02-27 Thread Peter Lübke
BTW, is there a particular reason why you retain  
m_designViewerController ? A newly allocated object *is* a retained  
object.
It will need one extra entire line of code to send a -release message  
to the object for it not to leak :-)


-Peter

Am 26.02.2011 um 09:08 schrieb koko:



1	m_designViewerController = [[[NSWindowController alloc]  
initWithWindowNibName:@"DesignViewer"] retain];


___

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

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

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

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


Re: "context-aware" bindings

2011-02-27 Thread Joanna Carter
Le 27 févr. 2011 à 10:07, Andy Lee a écrit :

> On Feb 27, 2011, at 3:19 AM, Mikkel Eide Eriksen wrote:
>> I have a property on an object that would ideally return either its value or 
>> nil, depending on the context it's being called from.
> 
> Can you tell us the name of the object and the property, and describe the 
> different contexts? I'm having trouble imagining such a requirement.
> 
>> I could do this with multiple selectors, but was wondering if there was a 
>> "cleaner" way of determining how it is being called.
> 
> It seems to me a property that can return multiple values isn't really a 
> property. It's either a method you pass a parameter to (to specify "context" 
> -- which of course won't work for bindings), or it's multiple properties 
> (i.e., multiple selectors -- what's not clean about that?).

There is certainly a design problem here. Why would two different callers 
expect a different result from a property, when one of those results is going 
to be nil?

If one of the callers is expecting nil returned, why bother calling the 
property?

Some idea of the code would be useful.

Joanna

--
Joanna Carter
Carter Consulting

___

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

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

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

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


Re: "context-aware" bindings

2011-02-27 Thread Andy Lee
On Feb 27, 2011, at 3:19 AM, Mikkel Eide Eriksen wrote:
> I have a property on an object that would ideally return either its value or 
> nil, depending on the context it's being called from.

Can you tell us the name of the object and the property, and describe the 
different contexts? I'm having trouble imagining such a requirement.

> I could do this with multiple selectors, but was wondering if there was a 
> "cleaner" way of determining how it is being called.

It seems to me a property that can return multiple values isn't really a 
property. It's either a method you pass a parameter to (to specify "context" -- 
which of course won't work for bindings), or it's multiple properties (i.e., 
multiple selectors -- what's not clean about that?).

--Andy


___

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

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

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

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


Re: MPVolumeView

2011-02-27 Thread Laurent Cerveau
Can't you just do what you want using directly CoreAudio?

laurent

On Feb 27, 2011, at 12:08 AM, David Rowland wrote:

> Apple seems to have made it impossible for an app to control the system 
> volume. The user can use the physical buttons, and an app can contain an 
> MPVolumeView which lets the user control the volume, but there is no 
> programmed access to that setting. 
> 
> I want a volume control that looks and behaves differently from MPVolumeView. 
> I think I know how to adapt it to do what I need except this -- when I touch 
> the control I want it to go to that setting. In other words, I don't want to 
> have to find the slider button first and then move it, just jump to the spot 
> I have touched.
> 
> Anyone have a suggestion?
> 
> thanks,
> 
> David
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/lcerveau%40me.com
> 
> This email sent to lcerv...@me.com

___

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

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

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

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


Re: "context-aware" bindings

2011-02-27 Thread Kyle Sluder
On Feb 27, 2011, at 12:19 AM, Mikkel Eide Eriksen  
wrote:

> I have a property on an object that would ideally return either its value or 
> nil, depending on the context it's being called from. I could do this with 
> multiple selectors, but was wondering if there was a "cleaner" way of 
> determining how it is being called.

There is no clean way to determine who called you. The desire to determine your 
caller is a pretty strong code smell. The separate property approach is the way 
to go.

We now return you to your regularly scheduled Saturday night.

--Kyle Sluder___

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

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

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

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


"context-aware" bindings

2011-02-27 Thread Mikkel Eide Eriksen
Hi,

I have a property on an object that would ideally return either its value or 
nil, depending on the context it's being called from. I could do this with 
multiple selectors, but was wondering if there was a "cleaner" way of 
determining how it is being called.

Regards,
Mikkel

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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