When clicking a button in the UI, i need to check whether Ctrl is pressed.
This code doesn’t work:
// This code is part of the function bound to the button click
if (ThisPC->IsInputKeyDown(EKeys::LeftControl))
{
// DO CTRL + CLICK
}
else
{
// DO CLICK
}
With this code i never visit the // DO CTRL+CLICK part.
Some people on the forum suggest that when the game focus on the UI, the player input is emptied and that this can be fixed using IsFocusable=false on the clicked button.
But this workaround doesn’t work in my case.
So is there a proper way to check if a key is pressed when clicking a UI button ?
Override onKeyDown and store the state, sample it during onMouseDown. Assuming that by click you mean mouse button click. Maybe you meant a button widget click? In which case skip the onMouseDown.