|
07/23/14, 03:59 AM | #1 |
|
Creating a whole bunch of Elements dynamic from code
I have been thinking for a while now about making something I call the "Event Explorer". A single window that allows you to register every event in the game for simple debugging/testing purposes.
LibConstantMapper provides me the ability to get all the Event ID and thier names in a fully automatic fashion. And later even get me subgroups. My current count for 1.2.6 is 469 Event ID's The only piece still missing is the GUI side of the equation. At a simple level the window will look like this: Window ->Row1 -->Label with event ID -->Label with event Name -->Checkbox to enabeled/disable listening to the event -->maybe extra checkboxes for the way the data is output (into chat, onscreen notification, how detailed the output should be (all parameters or only that the event was fired?)) ->Row2 -->Label with event ID ->Row3 I propably have to add some paging/register cards for efficiency. A later version will likely have some categories/filters/grouping for specific event groups (like all COMBAT Events). But for now the big issues are the handlers on the first checkbox. Basically I need one handler that can automagically identify to wich Row (and thus event ID) it belongs too. One handler to regsiter it 469 times at 469 UI Elements. I wil propably need a big code behind table anyway to hold all the data (wich setting is enabeled/disabeled). So if I need to store something like the UI Element reference after creating it would not be an issue. |
07/23/14, 05:04 AM | #2 |
|
I think paging will be the way to go. That way you create say 50 rows from a template, which you can write in xml with checkbox and labels already in it. You can put any data you want in the row control, similar to how inventory rows have control.data={bagId=1, slotIndex=2, etc}. There were ingame scripts from Aug 2013 on XeNTaX forum, where loot window was paged, and it did pretty much exactly what I described - OnInitialize created a fixed number of rows from a template, and on EVENT_LOOT_UPDATED and when switching pages, updated data in those rows.
Later you can even make a search filter, e.g. events containing "TRADE" in their name edit: can we even publish snippets from ingame scripts? It's so awkward to always tell people "there is something somewhere ..." Last edited by merlight : 07/23/14 at 05:07 AM. |
07/23/14, 06:07 AM | #3 | |
|
I know that as "Tag" property from WinForms and WPF. It is the second best solution for such a problem. What is the way to get the "parent" XML Element of a control? I would perfer to just drop the Event's ID as data in the Row. The event handler would get the Checkboxes Reference. Then I would go up on step to get the Row it is contained in and use the ID from that. Edit: I think I found it. Something liek thsi event handler code? Lua Code:
Last edited by zgrssd : 07/23/14 at 06:10 AM. |
|
07/23/14, 06:28 AM | #4 |
|
|
07/23/14, 02:00 PM | #5 |
|
I took the basic window from AIResearch Grid:
xml Code:
Added merlights template: xml Code:
And made up some basic code to get the table and fill the window with entries: Lua Code:
And all I get are those error messages and an empty window: Code:
CreateControlFromVirtual failed. ControlName[EventExplorerDynamicRow1], ParentName[EventExplorerWindow], VirtualName[EventExplorerRow]. CreateControlFromVirtual failed. ControlName[EventExplorerDynamicRow2], ParentName[EventExplorerWindow], VirtualName[EventExplorerRow]. CreateControlFromVirtual failed. ControlName[EventExplorerDynamicRow3], ParentName[EventExplorerWindow], VirtualName[EventExplorerRow]. |
07/23/14, 02:19 PM | #6 |
How your xml looks like? It should be something like this:
xml Code:
There is no UI error with this .xml file. |
|
07/23/14, 06:21 AM | #7 |
|
I tried to write some untested code for illustration. Careful with dot where colon should be -- control:GetParent()
edit: or look at LAM controls, they too have custom data: control.panel is the panel it's contained in control.data is the optionData it was created from Code:
<Control name="EventExplorerRow" virtual="true"> <Dimensions y="45"/> <Controls> <Label name="$(parent)Id" font="ZoFontGame" horizontalAlignment="RIGHT"> <Anchor point="RIGHT" relativePoint="LEFT" offsetX="50"/> </Label> <Label name="$(parent)Name" font="ZoFontGame"> <!-- I don't know how, but it's definitely possible to make this clickable, so that you can enable/disable events by cliking on the name (see "ZO_CheckButtonLabel") --> <Anchor point="LEFT" relativeTo="$(parent)Id" relativePoint="RIGHT" offsetX="20"/> </Label> </Controls> </Control> Lua Code:
Lua Code:
Last edited by merlight : 07/23/14 at 06:30 AM. |
ESOUI » Developer Discussions » Lua/XML Help » Creating a whole bunch of Elements dynamic from code |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|