Thread Tools Display Modes
12/08/17, 11:48 AM   #1
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
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.
  Reply With Quote
12/08/17, 12:21 PM   #2
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Where, when, why?
You have RegisterTopLevel to handle ESC, EditBox has an event "OnEscape". And pressing ESC can cause GAME_MENU_SCENE gets shown.
  Reply With Quote
12/08/17, 04:40 PM   #3
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
The goal was to make all of the windows of the addon close when Esc is pressed.
  Reply With Quote
12/09/17, 02:33 AM   #4
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
In this case my first approach would be:
SCENE_MANAGER:RegisterTopLevel(topLevel, locksUIMode)
Like in AI Research Grid.
  Reply With Quote
12/09/17, 02:40 PM   #5
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
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.
  Reply With Quote
12/12/17, 02:34 AM   #6
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
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).

Last edited by Phinix : 12/12/17 at 02:38 AM.
  Reply With Quote
12/13/17, 04:52 PM   #7
Rhyono
AddOn Author - Click to view addons
Join Date: Sep 2016
Posts: 659
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.
  Reply With Quote
12/14/17, 12:32 AM   #8
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by Rhyono View Post
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.
  Reply With Quote
12/14/17, 06:06 AM   #9
Phinix
 
Phinix's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 186
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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Check for Esc press

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