Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Why does HIViewAdvanceFocus fail?



To be honest, I've had lots of problems making the logic
of "advancing" focus work correctly, so I use only the
older SetKeyboardFocus API.

My "set keyboard focus" utility routine has this sequence:

error = SetKeyboardFocus(HIViewGetWindow(inView), inView, kControlFocusNoPart);
if (noErr == error)
{
error = SetKeyboardFocus(HIViewGetWindow(inView), inView, kControlFocusNextPart);
}


This correctly "sets" the focus to the specified view
regardless of the current focus.

Kevin G.



I have a window with two text fields, and when it is shown I want the first field to be focused. I do this by handling kEventWindowActivated and calling HIViewAdvanceFocus, but it returns errCouldntSetFocus. This error happens every time the window activates (switching to another app and back), until I manually click in one of the edit fields to focus it.

What's going on? What is it that gets fixed by clicking the edit field?

Another problem is that the tab key does not switch the focus between the edit fields, which I suspect is related.

I tried handling some other focus-related window events instead, like kEventWindowFocusContent or FocusAcquired, but those events never seemed to get sent.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden
References: 
 >Why does HIViewAdvanceFocus fail? (From: David Catmull <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.