ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   Lua/XML Help (https://www.esoui.com/forums/forumdisplay.php?f=175)
-   -   Check for Esc press (https://www.esoui.com/forums/showthread.php?t=7500)

Rhyono 12/08/17 11:48 AM

Check for Esc press
 
Does anyone have any clever tricks for detecting this? I'm using EVENT_GAME_CAMERA_UI_MODE_CHANGED as a catch all, but I was hoping that since Esc is a special system-only key that it'd have some sort of additional detection.

votan 12/08/17 12:21 PM

Where, when, why?
You have RegisterTopLevel to handle ESC, EditBox has an event "OnEscape". And pressing ESC can cause GAME_MENU_SCENE gets shown.

Rhyono 12/08/17 04:40 PM

The goal was to make all of the windows of the addon close when Esc is pressed.

votan 12/09/17 02:33 AM

In this case my first approach would be:
SCENE_MANAGER:RegisterTopLevel(topLevel, locksUIMode)
Like in AI Research Grid.

Rhyono 12/09/17 02:40 PM

One of my UIs I want to ensure the close of is for blueprints, so I did it like so:

SCENE_MANAGER:RegisterTopLevel(CraftStoreFixed_Blueprint_Window, false)

This does close it, but it will not let Esc clear cursor mode anymore. I'm not sure what I'm doing incorrectly.

Phinix 12/12/17 02:34 AM

Add this to the function that fires when the scene pops:

SCENE_MANAGER:ToggleTopLevel(CraftStoreFixed_Blueprint_Window)

From /internalingame/scenes/internalingamescenemanager.lua.html:

Code:

function ZO_InternalIngameSceneManager:ToggleTopLevel(topLevel)
    if(topLevel:IsControlHidden()) then
        self:ShowTopLevel(topLevel)
    else
        self:HideTopLevel(topLevel)
    end
end

That way you can use it to handle showing or hiding. Otherwise you should just be able to use InternalIngameSceneManager:HideTopLevel(CraftStoreFixed_Blueprint_Window) directly (untested).

Rhyono 12/13/17 04:52 PM

In order to HideTopLevel you have to RegisterTopLevel (it seems; which makes sense), but if you register it, it breaks Esc being able to get you out of mouse mode. I'm a little confused here.

votan 12/14/17 12:32 AM

Quote:

Originally Posted by Rhyono (Post 33399)
In order to HideTopLevel you have to RegisterTopLevel (it seems; which makes sense), but if you register it, it breaks Esc being able to get you out of mouse mode. I'm a little confused here.

There were bugs with ESC due to leaking "self" in the past.

Phinix 12/14/17 06:06 AM

I use register/toggle top level for the display/hiding of ESO Master Recipe List and never had a problem using escape to return to game mode.


All times are GMT -6. The time now is 12:10 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI