ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   How to put a control on the Guild Home page (https://www.esoui.com/forums/showthread.php?t=7161)

BoarGules 06/21/17 10:57 AM

How to put a control on the Guild Home page
 
I want to put a control on the Guild Home screen. But I can't find a suitable event to respond to, comparable to EVENT_CRAFTING_STATION_INTERACT for crafting stations, or EVENT_OPEN_GUILD_BANK for the guild bank. Have I just overlooked it, or do I need a different approach?

sirinsidiator 06/21/17 11:34 AM

In most cases you shouldn't actually add elements in response to an event, but instead create a scenefragment and assign it to a scene.
For example the guild home menu is a scene. The buttons on top (home, roster, history, etc) are one fragment which is added to the guild home scene.
A fragment is basically just a wrapper around a control and can be added to any number of scenes. When a scene shows up, it will automatically make all its fragments visible.

The scene you are looking for is called GUILD_HOME_SCENE. For most cases you can just create a ZO_SimpleSceneFragment.

Lua Code:
  1. local fragment = ZO_SimpleSceneFragment:New(myControl)
  2. GUILD_HOME_SCENE:AddFragment(myControl)

Of course you need to set your anchors as required. If you reuse a fragment on different scenes and want to position it relative to different elements, you can listen to a scene's "StateChange" callback:

Lua Code:
  1. GUILD_HOME_SCENE:RegisterCallback("StateChange", function(oldState, newState)
  2.     myControl:ClearAnchors()
  3.     if(GUILD_HOME_SCENE:IsShowing()) then
  4.         myControl:SetAnchor(...) -- configuration a
  5.     else
  6.         myControl:SetAnchor(...) -- configuration b
  7.     end
  8. end)

Otherwise you could just set them once when you first create the fragment.

BoarGules 06/22/17 06:12 AM

Thank you for the very helpful reply.

BoarGules 06/24/17 02:19 PM

Despite your help, I'm not yet up to speed. I'm having trouble positioning my control relative to
GUILD_HOME_SCENE. It is quite clearly being positioned relative to the main window. I suspect that is because my container control is an instance of TopLevelControl, which I'm sure isn't right, but it is the only thing the tutorials suggest, and I can't find any indication of what else it could be.

Code:

<GuiXml>
  <Controls>
    <TopLevelControl name="MyControl" hidden="true">
      <Dimensions x="200" y="200" />
      <Anchor point="BOTTOM" relativeTo="$(parent)" relativePoint="BOTTOM"  />
      <Controls>
        ... etc
      </Controls>
    </TopLevelControl>
  </Controls>
</GuiXml>


Baertram 06/24/17 03:01 PM

Perhaps try to change the relative anchor point of your control:

Code:

relativeTo="ZO_GuildHome"
or
Code:

relativeTo="ZO_GuildSharedInfo"
You can check the guild home files inside the esoui source code (download here http://www.esoui.com/downloads/info1...ourcecode.html
and extract, then look into the folders "esoui/ingame/guild").

Inside the keyboard subfolder you'll find the file guildhome_keyboard.xml and .lua including some control names where you could anchor to or set the parent of your control by the help of lua commands:

Lua Code:
  1. yourControl:SetParent(parentControlName)

BoarGules 06/27/17 09:55 AM

I'm trying to follow this advice:

Quote:

Originally Posted by sirinsidiator (Post 31573)
Of course you need to set your anchors as required. ... [Y]ou can listen to a scene's "StateChange" callback:

Lua Code:
  1. GUILD_HOME_SCENE:RegisterCallback("StateChange", function(oldState, newState)
  2.     myControl:ClearAnchors()
  3.     if(GUILD_HOME_SCENE:IsShowing()) then
  4.         myControl:SetAnchor(...) -- configuration a
  5.     end
  6. end)

My difficulty is that calling myControl:ClearAnchors() results in the message *function expected instead of nil* and d() confirms that myControl.ClearAnchors is in fact nil (but myControl is not). Any suggestions about what I am doing wrong?

votan 06/27/17 10:44 AM

Quote:

Originally Posted by BoarGules (Post 31648)
I'm trying to follow this advice:



My difficulty is that calling myControl:ClearAnchors() results in the message *function expected instead of nil* and d() confirms that myControl.ClearAnchors is in fact nil (but myControl is not). Any suggestions about what I am doing wrong?

Show us your definition of myControl. I would say your myControl is not a control, but something else.


All times are GMT -6. The time now is 05:44 PM.

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