# Text box focus issue in samplitude

**URL:** <https://forum.juce.com/t/text-box-focus-issue-in-samplitude/15090>\
**Category:** Audio Plugins\
**Created:** [July 8, 2015, 7:01pm UTC](https://forum.juce.com/t/text-box-focus-issue-in-samplitude/15090 "2015-07-08T19:01:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcollins78728](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mcollins78728](https://forum.juce.com/u/mcollins78728)\
**Post date:** [July 8, 2015, 7:01pm UTC](https://forum.juce.com/t/text-box-focus-issue-in-samplitude/15090/1 "2015-07-08T19:01:34Z")

</div>

When I bring up my plugin's&nbsp;editor, the first text editor control&nbsp;automatically grabs keyboard focus. This happens&nbsp;without the user clicking&nbsp;on the control and is an undesired behavior. This only happens in Samplitude (64-bit/VST/Windows) and not in any other host that I have tried.

The call stack is as follows:

&nbsp; &nbsp; &nbsp;dll!juce::Component::grabKeyboardFocus() &nbsp;Line 2824&nbsp;&nbsp; &nbsp;C++  
&nbsp; &nbsp; &nbsp;dll!juce::ComponentPeer::handleFocusGain() &nbsp;Line 355&nbsp;&nbsp; &nbsp;C++  
\> &nbsp; &nbsp;dll!juce::HWNDComponentPeer::peerWindowProc(HWND\_\_ \* h=0x0000000001d805d0, unsigned int message=7, unsigned \_\_int64 wParam=13635884, \_\_int64 lParam=0) &nbsp;Line 2506&nbsp;&nbsp; &nbsp;C++  
&nbsp; &nbsp; &nbsp;dll!juce::HWNDComponentPeer::windowProc(HWND\_\_ \* h=0x0000000001d805d0, unsigned int message=7, unsigned \_\_int64 wParam=13635884, \_\_int64 lParam=0) &nbsp;Line 2358 + 0x23 bytes&nbsp;&nbsp; &nbsp;C++  
  
I would appreciate any help in correcting this.

---

<div class="post-metadata">

**Author:** ![mcollins78728](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mcollins78728](https://forum.juce.com/u/mcollins78728)\
**Post date:** [July 17, 2015, 8:43pm UTC](https://forum.juce.com/t/text-box-focus-issue-in-samplitude/15090/2 "2015-07-17T20:43:14Z")

</div>

Well I figured out a workaround. You should probably go ahead and close this one.

---

<div class="post-metadata">

**Author:** ![jgerrard](https://avatars.discourse-cdn.com/v4/letter/j/b782af/32.png) [@jgerrard](https://forum.juce.com/u/jgerrard)\
**Post date:** [July 20, 2015, 7:21am UTC](https://forum.juce.com/t/text-box-focus-issue-in-samplitude/15090/3 "2015-07-20T07:21:43Z")

</div>

Thanks for letting us know about this.

What was your workaround?

---

<div class="post-metadata">

**Author:** ![mcollins78728](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@mcollins78728](https://forum.juce.com/u/mcollins78728)\
**Post date:** [July 23, 2015, 5:23pm UTC](https://forum.juce.com/t/text-box-focus-issue-in-samplitude/15090/4 "2015-07-23T17:23:56Z")

</div>

I called&nbsp;&nbsp;&nbsp; &nbsp;grabKeyboardFocus(); on the main editor component after it was done initializing. This seems to work.
