Quantcast frame blocks keyboard input - WoWInterface
Thread Tools Display Modes
04-06-20, 07:57 AM   #1
blocker147
A Deviate Faerie Dragon
Join Date: Apr 2020
Posts: 11
frame blocks keyboard input

How not to block keyboard bindings when my Frame is shown? For example I want to use WSAD and move with my hero when Frame is shown but I cant.
  Reply With Quote
04-06-20, 08:45 AM   #2
Lybrial
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 86
A frame usually does not block keyboard inputs.

Lua Code:
  1. local frame = CreateFrame("Frame", "SomeFrame" _G.UIParent);
  2. frame:SetSize(50, 50);
  3. frame:SetPoint("CENTER");
  4. frame:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
  5.                                             edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
  6.                                             tile = true, tileSize = 16, edgeSize = 16,
  7.                                             insets = { left = 4, right = 4, top = 4, bottom = 4 }});

Above code creates a 50 x 50 frame in the middle of the screen.
It wont block any keyboard inputs.
  Reply With Quote
04-06-20, 09:02 AM   #3
blocker147
A Deviate Faerie Dragon
Join Date: Apr 2020
Posts: 11
But why my frame could block keyboard input? It depends on the frame size? I found method EnableKeyboard() and it is set to false. Which one frame method could block keyboard input? What should I look for?
  Reply With Quote
04-06-20, 10:50 AM   #4
Lybrial
A Black Drake
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 86
It would help if you post your code
  Reply With Quote
04-06-20, 12:55 PM   #5
blocker147
A Deviate Faerie Dragon
Join Date: Apr 2020
Posts: 11
Originally Posted by Lybrial View Post
It would help if you post your code
Actually too much code for posting ~300 lines. I will show structure and screens.
And the question is what can block keyboard inputs?
Click image for larger version

Name:	mainframe.png
Views:	69
Size:	337.0 KB
ID:	9435
Click image for larger version

Name:	structure.png
Views:	78
Size:	15.1 KB
ID:	9434
Click image for larger version

Name:	mainframesettings1.png
Views:	75
Size:	16.5 KB
ID:	9436
Click image for larger version

Name:	mainframesettings2.png
Views:	69
Size:	10.3 KB
ID:	9437
  Reply With Quote
04-07-20, 02:39 PM   #6
JDoubleU00
A Scalebane Royal Guard
 
JDoubleU00's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 441
If you put your code within tags, then 300 lines are not too much. That creates a scrollable box.
__________________
Author of JWExpBar and JWRepBar.
  Reply With Quote
04-07-20, 05:41 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,206
If you have an EditBox (if that's what the second image is suggesting (ebKeyWord)) that could be automatically taking focus.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 04-07-20 at 05:44 PM.
  Reply With Quote
04-08-20, 07:11 AM   #8
blocker147
A Deviate Faerie Dragon
Join Date: Apr 2020
Posts: 11
Originally Posted by JDoubleU00 View Post
If you put your code within tags, then 300 lines are not too much. That creates a scrollable box.
my xml code only editbox:
Code:
<EditBox name="ebKeyWord" inherits="InputBoxTemplate" enableKeyboard="true" autoFocus="false">
	<Size x="115" y="32" />
	<Anchors>
	        <Anchor point="TOPLEFT" x="120" y="-5" />
	</Anchors>
	<Scripts>
		<OnEnterPressed>
			ebKeyWord_OnEnterPressed()
		</OnEnterPressed>
	</Scripts>
</EditBox>
my xml code (almost full):
Code:
<Ui xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.blizzard.com/wow/ui/">
	<Script file="Frame.lua" />
	<Frame name="MainFrame" movable="true" enableMouse="true">
		<Size x="600" y="425" />
		<Anchors>
			<Anchor point="CENTER" x="0" />
		</Anchors>
		<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Background-Dark.PNG" edgeFile="Interface\DialogFrame\UI-DialogBox-Border.PNG" tile="true">
			<BackgroundInsets>
				<AbsInset left="10" right="10" top="10" bottom="10" />
			</BackgroundInsets>
			<TileSize val="32" />
			<EdgeSize val="32" />
			<Color r="0" g="0" b="0" a="0.7" />
		</Backdrop>
		<Frames>
			<Frame name="CloseWindowFrame">
				<Size x="32" y="32" />
				<Anchors>
					<Anchor point="TOPRIGHT" x="-4" y="-4" />
				</Anchors>
				<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Corner.PNG" edgeFile="" />
				<Frames>
					<Button name="btnCloseWindow" inherits="UIPanelCloseButton" parent="" text="X">
						<Size x="32" y="32" />
						<Anchors>
							<Anchor point="TOPLEFT" x="4" y="4" />
						</Anchors>
						<Backdrop bgFile="" edgeFile="" />
						<Scripts>
							<OnClick>
								btnCloseWindow_OnClick()
							</OnClick>
						</Scripts>
					</Button>
				</Frames>
			</Frame>
			<Frame name="TitleFrame" parent="MainFrame">
				<Size x="250" y="70" />
				<Anchors>
					<Anchor point="TOP" x="0" y="10" />
				</Anchors>
				<Backdrop bgFile="Interface\DialogFrame\UI-DialogBox-Header.PNG" edgeFile="">
					<TileSize val="32" />
					<EdgeSize val="32" />
				</Backdrop>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="fsTitle" inherits="GameFontNormalLarge" text="Chat Filter">
							<Size x="250" y="70" />
							<Anchors>
								<Anchor point="CENTER" y="12" />
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
			</Frame>
			<ScrollFrame name="ScrollFrame1" inherits="UIPanelScrollFrameTemplate">
				<Size x="550" y="256" />
				<Anchors>
					<Anchor point="BOTTOM" x="-10" y="10" />
				</Anchors>
				<Backdrop bgFile="" edgeFile="">
					<TileSize val="32" />
					<EdgeSize val="32" />
				</Backdrop>
				<Frames>
					<Frame name="MessageBoxFrame">
						<Size x="550" y="256" />
						<Anchors>
							<Anchor point="TOP" />
						</Anchors>
						<Backdrop bgFile="" edgeFile="">
							<TileSize val="32" />
							<EdgeSize val="32" />
						</Backdrop>
					</Frame>
				</Frames>
				<Scripts>
					<OnMouseWheel>
						ScrollFrame1_OnMouseWheel()
					</OnMouseWheel>
				</Scripts>
			</ScrollFrame>
			<Frame name="ConfigFrame" parent="MainFrame">
				<Size x="550" y="100" />
				<Anchors>
					<Anchor point="TOP" x="-10" y="-30" />
				</Anchors>
				<Backdrop bgFile="" edgeFile="Interface\Tooltips\UI-Tooltip-Border.PNG">
					<BackgroundInsets left="4" right="4" top="4" bottom="4" />
					<TileSize val="32" />
					<EdgeSize val="16" />
					<Color r="1" g="1" b="1" />
					<BorderColor r="0.706" g="0.706" b="0.706" />
				</Backdrop>
				<Layers>
					<Layer level="OVERLAY">
						<FontString name="fsAddKeyWord" inherits="GameFontNormal" text="Enter Keyword:">
							<Size x="115" y="32" />
							<Anchors>
								<Anchor point="TOPLEFT" x="5" y="-5" />
							</Anchors>
						</FontString>
						<FontString name="fsFoundKeyInMessage" inherits="GameFontNormalLarge" text="" justifyH="LEFT">
							<Size x="358" y="32" />
							<Anchors>
								<Anchor point="LEFT" x="47" y="-5" />
							</Anchors>
						</FontString>
						<FontString name="fsFindInRaidNames" inherits="GameFontHighlight" text="Find in raid names ?" justifyH="LEFT">
							<Size x="125" y="32" />
							<Anchors>
								<Anchor point="TOPRIGHT" x="-25" y="-5" />
							</Anchors>
						</FontString>
					</Layer>
				</Layers>
				<Frames>
					<Button name="btnAddKeyWord" inherits="UIPanelButtonTemplate" ignoreParentAlpha="true" text="Add Keyword">
						<Size x="100" y="25" />
						<Anchors>
							<Anchor point="TOPLEFT" x="240" y="-10" />
						</Anchors>
						<Scripts>
							<OnClick>
								btnAddKeyWord_OnClick()
							</OnClick>
						</Scripts>
					</Button>
					<EditBox name="ebKeyWord" inherits="InputBoxTemplate" enableKeyboard="true" autoFocus="false">
						<Size x="115" y="32" />
						<Anchors>
							<Anchor point="TOPLEFT" x="120" y="-5" />
						</Anchors>
						<Scripts>
							<OnEnterPressed>
								ebKeyWord_OnEnterPressed()
							</OnEnterPressed>
						</Scripts>
					</EditBox>
					<CheckButton name="cbFindInRaidNames" inherits="UICheckButtonTemplate" text="CheckButton1">
						<Size x="32" y="32" />
						<Anchors>
							<Anchor point="TOPRIGHT" x="-150" y="-5" />
						</Anchors>
						<Scripts>
							<OnClick>
								cbFindInRaidNames_OnClick()
							</OnClick>
						</Scripts>
					</CheckButton>
					<Frame name="KeywordImageFrame">
						<Size x="24" y="24" />
						<Anchors>
							<Anchor point="LEFT" x="10" y="-5" />
						</Anchors>
						<Backdrop bgFile="Interface\ICONS\INV_Misc_Key_12.PNG" edgeFile="">
							<TileSize val="32" />
							<EdgeSize val="32" />
						</Backdrop>
					</Frame>
				</Frames>
			</Frame>
		</Frames>
		<Scripts>
			<OnLoad>
				MainFrame_OnLoad()
			</OnLoad>
			<OnKeyDown>
				MainFrame_OnKeyDown()
			</OnKeyDown>
			<OnDragStart>
				MainFrame_OnDragStart()
			</OnDragStart>
			<OnDragStop>
				MainFrame_OnDragStop()
			</OnDragStop>
			<OnEvent>
				MainFrame_OnEvent()
			</OnEvent>
			<OnShow>
				MainFrame_OnShow()
			</OnShow>
			<OnHide>
				MainFrame_OnHide()
			</OnHide>
		</Scripts>
	</Frame>
</Ui>
  Reply With Quote
04-08-20, 09:20 AM   #9
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,206
https://wow.gamepedia.com/UIHANDLER_OnKeyDown
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
04-08-20, 10:15 AM   #10
blocker147
A Deviate Faerie Dragon
Join Date: Apr 2020
Posts: 11
Originally Posted by Fizzlemizz View Post
Cool! This thing blocked my keyboard. But the next question is how to close MainFrame when escape is pressed? I tried to disable keyboard when key up or key down but this wont work.
Maybe I need to create event OnKeyDown on my button rather than on MainFrame?
Code:
function MainFrame_OnKeyDown()
	if arg1 == "ESCAPE" then MainFrame:Hide() end
end
function MainFrame_OnKeyUp()
	MainFrame:EnableKeyboard(false)
end
  Reply With Quote
04-08-20, 10:43 AM   #11
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,206
Frame names are global so MainFrame is not a good name. You should also add $parent to subframe names (and/or use the parentKey attribute).

Code:
<Frame name="blocker147MainFrame" movable="true" enableMouse="true">
...
    <OnLoad>
        tinsert(UISpecialFrames, "blocker147MainFrame")
    </OnLoad>
</Frame>
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 04-08-20 at 11:45 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » frame blocks keyboard input

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