# hasKeyboardFocus() - Win vs. iOS

**URL:** <https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986>\
**Category:** Audio Plugins\
**Created:** [June 5, 2011, 9:39am UTC](https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986 "2011-06-05T09:39:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shlomi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/shlomi/32/99_2.png) [@Shlomi](https://forum.juce.com/u/Shlomi)\
**Post date:** [June 5, 2011, 9:39am UTC](https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986/1 "2011-06-05T09:39:24Z")

</div>

Hi.

In Windows I know when the user has clicked outside my plugin using hasKeyboardFocus() on my main component.  
In iOS, it seems that it doesn’t work this way.

“outside my window” = on the host window surrounding my plugin.

So how can I detect that in iOS?

Background:  
I’m using a TopLevelWindow that covers my plugin to catch keystrokes, it does the job well.  
I need to know when the user is clicking outside the plugin to set it invisible when not needed.

Thanks

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 5, 2011, 11:21am UTC](https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986/2 "2011-06-05T11:21:00Z")

</div>

iOS? Surely you mean OSX?

---

<div class="post-metadata">

**Author:** ![Shlomi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/shlomi/32/99_2.png) [@Shlomi](https://forum.juce.com/u/Shlomi)\
**Post date:** [June 5, 2011, 12:01pm UTC](https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986/3 "2011-06-05T12:01:07Z")

</div>

Yes, OSX, sorry…

---

<div class="post-metadata">

**Author:** ![Shlomi](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/shlomi/32/99_2.png) [@Shlomi](https://forum.juce.com/u/Shlomi)\
**Post date:** [June 6, 2011, 7:40am UTC](https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986/4 "2011-06-06T07:40:10Z")

</div>

It looks like the focus stays inside the Juce components even when I’m clicking on the plugin host’s window and dragging it.  
But when I’m clicking on another application, the focus goes away.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [June 6, 2011, 8:31am UTC](https://forum.juce.com/t/haskeyboardfocus-win-vs-ios/6986/5 "2011-06-06T08:31:41Z")

</div>

OSX is a bit problematic for focus info like that, especially inside a host - if it doesn’t get a focusLost callback then that’s probably because I couldn’t find a way to detect it.
