ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   How to get a Control to only show on the Quickslot scene / fragment? (https://www.esoui.com/forums/showthread.php?t=7311)

static_recharge 08/20/17 02:23 PM

How to get a Control to only show on the Quickslot scene / fragment?
 
I'm trying to get my toplevel control to only show when the user has the quickslot menu open in the inventory scene. I've looked around these forums and have had lots of success adding my control to other scenes, but the inventory scene is a local scene according to the source code.

I'm pretty sure I'm going to have to use callbacks and monitor the change of scenes myself but I'm not sure where to start or how to use the callback function to correctly achieve this. Basically I just want my control on the screen when the user has the quickslot tab of the inventory menu open and hidden all other times.

Thanks in advance!

Baertram 08/20/17 02:31 PM

I think there is a fragment inside the inventory scene which tells you that the quickslot is active.
If you register a callback funciton to this fragment's (if it exists) onStateChange function (like scenes provide too) you could be able to solve your problem.

Check the esoui source code and search for inventory and inside the lua files for quickslot (or the other way around).
http://www.esoui.com/downloads/info1...ourcecode.html

https://github.com/esoui/esoui/tree/master/esoui

Edit:
Found a quickslot framgent:
https://github.com/esoui/esoui/searc...fragment&type=

-

You need tor egister a callback function to:
Lua Code:
  1. QUICKSLOT_FRAGMENT:RegisterCallback("StateChange",  function(oldState, newState)
  2. -[[ possible states are:
  3.                 SCENE_FRAGMENT_SHOWN = "shown"
  4.                 SCENE_FRAGMENT_HIDDEN = "hidden"
  5.                 SCENE_FRAGMENT_SHOWING = "showing"
  6.                 SCENE_FRAGMENT_HIDING = "hiding"
  7.             ]]--
  8. if newState == SCENE_FRAGMENT_SHOWN then
  9.  --YourCotrol:SetHidden(false)
  10. elseif newState == SCENE_FRAGMENT_HIDING then
  11.  --YourCotrol:SetHidden(true)
  12. end
  13. end) -- function

Be sure to check direct scene changes from mail send to inventory (or the other way around by using a keaybind!) as sometimes the scenes and fragment callback functions will not be called properly then. Maybe you need to check this somehow via scene changes and hide your control again then.

static_recharge 08/20/17 02:58 PM

Thank you so much Baertram! Works like a charm and very simple to understand what is going on. Thanks again!


All times are GMT -6. The time now is 03:25 PM.

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