Thread Tools Display Modes
09-26-06, 10:06 AM   #1
Aule
A Fallenroot Satyr
 
Aule's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 20
Unhappy Edit Box Focus

I've got a frame with a couple edit boxes in it that steal ALL keyboard events while the frame is showing. I need the user to still be able to participate in chat while the UI is up, but presently as long as it's showing, they can't click on chat to give focus to their chat window....ALL keypresses go into my edit boxes. Is there a way to get them to give up focus when the user clicks off the frame?

Thanks!
  Reply With Quote
09-26-06, 10:32 AM   #2
Gello
A Molten Giant
AddOn Author - Click to view addons
Join Date: Jan 2005
Posts: 521
Make sure the edit box has autoFocus="false" (or make sure it doesn't have autoFocus="true" -- I forget which is default).

When an EditBox has autoFocus on, it will grab the focus whenever it can.

Also to help, in your EditBox's <Scripts>, add an <OnEscapePressed> that does a this:ClearFocus():

Code:
<EditBox name="MyEditBox" autoFocus="false" etc>
  <Scripts>
    <OnEscapePressed>
      this:ClearFocus()
    </OnEscapePressed>
  </Scripts>
</EditBox>
When a user hits ESC while in the editbox it will clear focus. This is especially nice with frames that go away with ESC (UISPecialFrames). The user can keep hitting ESC to "peel back" layers of involvement in your mod.
  Reply With Quote
09-26-06, 10:38 AM   #3
Aule
A Fallenroot Satyr
 
Aule's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 20
Thanks!

Thanks Gello!!!
  Reply With Quote
11-04-06, 07:01 AM   #4
Airlag
A Deviate Faerie Dragon
Join Date: Nov 2006
Posts: 12
AutoFocus = true by default (unfortunately)
AutoFocus is not available in the properties window, you currently have to change it with this:SetAutoFocus(false); in OnLoad.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Edit Box Focus


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off