widget not getting focus when not set in event tick

i’m trying to make a menu for my game and i couldn’t figure out this problem.
my options menu;

when i don’t set focus on event tick, Q E and ESC keys doesn’t work so i set focus on event tick, but when i use set focus; dropdown it doesn’t open. what can i do and how can i get these both to work?

image

There should never be a need to set focus on Tick.

  • how did you implement Q & E?
  • which input mode are we in?
  • is it OK for this menu to operate in UI only mode?
1 Like

thanks for answer, i know but otherwise it doesn’t work so i had to set on event tick

level blueprint;


input mode; Game and UI

i’m using on key down for Q,E and ESC inputs (in Display Widget)

and all widgets is focusable = true

here is the code for how can i open options widget (in MainMenu Widget);

if is important i’m using WidgetSwitcher for change option sub widget like display, graphics and audio

This seems OK at a glance. Not sure what happens to your focus. Could you tell a bit more about the hierarchy and the switcher? How does it all work / is organised - the big picture. What does the switcher call really do?

Does this mean that every widget handles its own input? Sounds complicated to do it like so:

I see you also remove self here:

Trying to wrap my mind around the way you structured it.


The usual approach is to have a master widget with a switcher and handle all input in this one widget only:

image

You’d dispatch back to the master from the user widgets. There would never be a need to add / remove any widgets. Focus switching can be added but may not be necessary.

1 Like

uh sorry i forgot to mention my hierarchy

WB_Main

  • WB_MainMenu Widget
    – Play Button
    – Options Button
    – Quit Button

here is the what Options Button do;

WB_OptionsMenu;

on key down inside WB_OptionsMenu widget.
only WB_OptionsMenu widget have WidgetSwitcher

i’m not sure if it’s clear

Much clearer!

image

Can we see this? Perhaps the widget we switch to somehow gets the focus? Try adding
image

After the abovementioned calls.

1 Like

Have you tried the Widget Reflector? You can easily tell (most of the time) where the focus has gone to:

It’s here:

Make it full screen on another screen (or suffer on one):

image

Run the project, mouse over stuff, see how things behave.

2 Likes

“Change Widget Switcher Index” is little mess but only do add current widget switcher index to input value and set Active Widget index * i’m planing to fix later

Did you try adding Set Keyboard Focus (self) here?

1 Like

yes and didn’t work

now time to on suffer widget reflector…

Just to clarify: are your widgets actually switching?

Are we sure something like that does not run elsewhere and steals focus?

image

1 Like

nope this code only in WB_OptionsMenu Widget
when i’m delete this or put in Event Construct (only) inputs doesn’t work (buttons works perfectly) but dropdown menu works perfectly

and yes set focus on event tick widgets are switching