Thread Tools Display Modes
08-05-18, 11:12 AM   #1
7strm
A Murloc Raider
Join Date: Aug 2016
Posts: 9
OnKeyDown script while EditBox has focus

I'm trying to build a functionality that by pressing tab lets me cycle through channels (with ChatMenu_SetChatType?) while the editbox is open. Essentially like the Overwatch editbox, if you know how that one behaves.

However, while the edit box has focus, I can't seem to listen to keystrokes with an OnKeyDown script at all.

Do you have an idea how to work around this?

Code:
local ksf = CreateFrame("Frame")
ksf:SetFrameStrata("DIALOG")
ksf:EnableKeyboard()
ksf:SetPropagateKeyboardInput(true)
ksf:SetScript("OnKeyDown", function(key)
    print(key)
end)
This works only when the editbox does not have focus.
  Reply With Quote
08-05-18, 02:47 PM   #2
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Lua Code:
  1. Editbox:SetScript("OnTabPressed", tabfunc)
__________________
  Reply With Quote
08-12-18, 11:07 AM   #3
JDoubleU00
A Firelord
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 463
Originally Posted by 7strm View Post
I'm trying to build a functionality that by pressing tab lets me cycle through channels (with ChatMenu_SetChatType?) while the editbox is open. Essentially like the Overwatch editbox, if you know how that one behaves.

However, while the edit box has focus, I can't seem to listen to keystrokes with an OnKeyDown script at all.

Do you have an idea how to work around this?

Code:
local ksf = CreateFrame("Frame")
ksf:SetFrameStrata("DIALOG")
ksf:EnableKeyboard()
ksf:SetPropagateKeyboardInput(true)
ksf:SetScript("OnKeyDown", function(key)
    print(key)
end)
This works only when the editbox does not have focus.
Great idea, I don't play Overwatch enough to realize it had that functionality.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » OnKeyDown script while EditBox has focus

Thread Tools
Display Modes

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