Re: Window's kAXMinimizedAttribute Can Only Be Set True
Re: Window's kAXMinimizedAttribute Can Only Be Set True
- Subject: Re: Window's kAXMinimizedAttribute Can Only Be Set True
- From: Michael Kamprath <email@hidden>
- Date: Wed, 04 Sep 2002 08:22:47 -0700
on 9/4/02 8:10 AM, Eric Schlegel at email@hidden wrote:
>
>
On Tuesday, September 3, 2002, at 08:07 PM, Michael Kamprath wrote:
>
>
> I am consistently getting error -1700 (errAECoercionFail) when I try
>
> to set
>
> a Carbon application's window UI element's kAXMinimizedAttribute
>
> attribute
>
> to kCFBooleanTrue. Why would Apple Event coercion be involved with
>
> this in
>
> any way?
>
>
Probably because internally, we use the AppleEvent Manager's coercion
>
facilities to extract parameters from Carbon events if the type doesn't
>
match. Can you post the code that you're using to set the attribute?
>
>
-eric
Sure, here it is:
void
XAXWindowElement::SetMinimized( bool inIsMinimized ) const throw (AXError)
{
try
{
if ( inIsMinimized )
{
this->SetAttributeValue( kAXMinimizedAttribute, kCFBooleanTrue );
}
else
{
this->SetAttributeValue( kAXMinimizedAttribute, kCFBooleanFalse );
}
}
catch ( AXError err )
{
//didn't work
}
}
XAXWindowElement is sub-classed from XAXUIElement, and here is the relevant
methods from that class:
void
XAXUIElement::SetAttributeValue( CFStringRef inAttributeKey, CFTypeRef
inValue ) const throw (AXError)
{
AXError theErr;
theErr = AXUIElementSetAttributeValue( (*this), inAttributeKey, inValue );
if (theErr != noErr ) throw theErr;
}
CFTypeRef
XAXUIElement::CopyAttributeValue( CFStringRef inAttributeKey ) const throw
(AXError)
{
CFTypeRef theValue = NULL;
AXError theErr;
theErr = ::AXUIElementCopyAttributeValue( (*this), inAttributeKey,
&theValue );
if (theErr != noErr ) throw theErr;
return theValue;
}
My XAXUIElement class is just a wrapper around a AXUIElementRef, whose value
is accessed by a type-cast operator:
XAXUIElement::operator AXUIElementRef() const
{
return this->mElementRef;
}
Now, I know the AXUIElementRef is valid as other calls to
XAXUIElement::CopyAttributeValue work as I can get the window name and even
*get* the value of kAXMinimizedAttribute, but setting kAXMinimizedAttribute
tields the -1700 error.
Michael F. Kamprath
email@hidden
Keyboard Maestro - Conduct Your Mac Like a Pro!
Download a free copy today at: www.KeyboardMaestro.com
_______________________________________________
accessibility-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/accessibility-dev
Do not post admin requests to the list. They will be ignored.