Adding elements to existing UI elements
Hi there,
after walking through the very basic addon tutorial, i come up with more questions than answers. I am familiar with Lua in a way from my studies. But i definetly lack the knowledge to interact with the ESO UI. I want to extend inventory and bank windows with a crafting-profession filter as well as a editbox for a full-text search. Well, the events aren't the problem. Adding the elements to the proper control is. On top of it: is there a predefined editBox (doesn't look like that) ? I tried to skip that problem with the usage of the library LibAddonMenu-1.0: Code:
LAM:AddEditBox(ZO_PlayerInventoryBackpack, "bbs_search", "filter inventory", "custom tooltip", false, getFunc(), setFunc()) Code:
local optionsWindow = ZO_OptionsWindowSettingsScrollChild |
From the description:
Quote:
|
*self-facepalm* configuration gui - got it ;)
But the UI elment question remains. |
Look to see how LAM creates the editbox. (Hint: I used a template from the default UI ;) )
|
Easiest way to achive your goal is to install zgoo and try to figure out which is the head control of the tabs.
type /zgoo mouse while you are on any filter button and have a look at his parent Should be something like ZO_PlayerInventoryFilterTab or so now have a look at the wiki example to dynamicly adding some controls to another. That should be enough to make it. if you need a complete soloutin and dont want to learn from it (i totally advice! you to do it by yourself), reply on my post and wait until i got time for it *lol* :D Cheers |
Thanks for the hints. I hate direct solutions and prefer learning by doing ;)
|
Ok, raised an UI error previously - messed up syntax. But now i see neither an error, nor an added editbox...
Code:
function BBS_Initialize() |
So, the CreateControl doesn't seem to create a visual UI element, or should it?
When is either or used? Couldn't find a list of valid virtual names. Code:
CreateControl(string arg1, object parent, integer type) |
1. Unless you need to access this function from another file, make it local.
Lua Code:
2. Only put your function name in the event handler. You want a reference for what to call when the event fires. Not what the function actually returns (which is, in this case, nil). ;) 3. You need to tell the EVENT_MANAGER what is registering for this event. So the first argument is going to be a unique string for your addon. (The alternative is to register the event directly on a frame/control in your addon and skipping the event manager completely.) 4. EVENT_ADD_ON_LOADED fires for every addon that loads. You want to run your code if it's only your addon. Not 10 times for each addon that loads. ;) Use either of the below. Lua Code:
if addon == "MyAddonName" then[ --do all the things end end/highlight] 4. You created an edit box, but you did not give it a height or say how it should look or anything else. As I mentioned above, I used a template so I didn't have to create it from scratch. ;) /edit: re-read these two parts of the Addon Quick Questions section of the wiki: http://wiki.esoui.com/AddOn_Quick_Qu...events_work.3F http://wiki.esoui.com/AddOn_Quick_Qu...s_or_labels.3F |
Thanks for your effort in helping me ;)
Nice hint with the ADD_ON_LOADED_EVENT. Thought it was possible but not sure of it. Yeah, suddenly noticed copying the following was not a good idea ;) lua Code:
I played around with zgoo a bit and tried to analyse the guild filter search box. The controls are structured CT_BACKDROP > CT_EDITBOX > CT_LABEL. I now wonder why the CT_LABEL is used as a child of CT_EDITBOX. Is it just because of a default text if the editbox value is (empty) - would make sense :cool: |
Now i am stuck with setting appropriate handlers. Is there a list of valid and fireing events for controls? OnKeyup as well as Onclicked or OnFocus is not working.
lua Code:
|
Not sure how to add a filter as I found this trying to figure that out myself.
There is however an existing search box in the game, there's just no non-script way of showing it (AFAIK). /script ZO_PlayerInventorySearchBox:ToggleHidden() will toggle its visibility. |
Yeah, I came across stuff referencing that last night but didn't look too much into it. Nice find.
|
Quote:
Use zgoo to inspect which type of control you want to handle, head to the specific section and looks what it has of attributes additional childs and ofc which events (OnEvent). The most Controls inherits from Control which also have OnEvents so this is the overview you requested. Quote:
|
Thanks for the event list, really helped out. Only thing i miss now, is how to capture events for closing/opening bank/inventory/guildbank.
I came across that InventorySearchBox, too, but was thinking it is for internal use only. After showing it with :SetHidden(false), i first tried to reposition it with :SetParent(ZO_SharedRightPanelBackgroundLeft). But, strangely, changing its size with :SetDimensions(x, y) has no effect. :SetResizeToFitDescendents(false) has no effect, too. God, why do easy considerations last that long to implement? Horrible, like looking for a needle in a haystack. |
You can capture such events with :SetHandler("OnShow", MyAddOnFunctionOnShow)
However you need to set the handler to a toplevel window cause thats usually the only one wich is shown or hided. So ZO_PlayerInventory:SetHandler("OnShow", MyFunction) |
Nice hint, thought of event delegation but was wrong. But using TopLevel controlls makes perfect sense.
Still struggling with :SetAnchor and :SetDimensions after i changed an element's parent. |
All times are GMT -6. The time now is 11:57 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI