Thread Tools Display Modes
07/24/14, 02:19 PM   #21
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by merlight View Post
ZO_ScrollList has a child <Scroll name="$(parent)Contents" mouseEnabled="true">, use that as row parent, i.e. EventExplorerWindowScrollContents.
This one is not valid XML:
xml Code:
  1. <TopLevelControl name="EventExplorerWindow" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true" >
  2.             <Dimensions x="760" y="650" />
  3.             <Anchor point="CENTER" />
  4.             <Controls>
  5.                 <Backdrop name="$(parent)BG" inherits="ZO_DefaultBackdrop" />
  6.                 <Control name="$(parent)Scroll" inherits="ZO_ScrollList">
  7.                     <Anchor point="TOPLEFT" offsetY="30" />
  8.                     <Anchor point="BOTTOMRIGHT" />
  9.                     <Scroll  name="$(parent)Contents" mouseEnabled="true" />
  10.                 </Control>
  11.             </Controls>
  12.         </TopLevelControl>

While this seems to be valid XML, but EventExploerWindowSrcoll stays nil for some reason so I cannot assign anything to it:
xml Code:
  1. <TopLevelControl name="EventExplorerWindow" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true" >
  2.             <Dimensions x="760" y="650" />
  3.             <Anchor point="CENTER" />
  4.                 <Controls>
  5.                     <Backdrop name="$(parent)BG" inherits="ZO_DefaultBackdrop" />
  6.                     <Scroll name="$(parent)Scroll" mouseEnabled="true" />          
  7.                 </Control>
  8.             </Controls>
  9.         </TopLevelControl>
  Reply With Quote
07/24/14, 06:18 PM   #22
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
I think you misunderstood me Keep your XML exactly as you had it on the previous page. Only change the parent in Lua code from EventExplorerWindowScroll to EventExplorerWindowScrollContents.

Originally Posted by zgrssd View Post
Currently my XML looks like this:
xml Code:
  1. <TopLevelControl name="EventExplorerWindow" mouseEnabled="true" movable="true" clampedToScreen="true" hidden="true" >
  2.             <Dimensions x="760" y="650" />
  3.             <Anchor point="CENTER" />
  4.             <Controls>
  5.                 <Backdrop name="$(parent)BG" inherits="ZO_DefaultBackdrop" />
  6. <!-- *** -->        <Control name="$(parent)Scroll" inherits="ZO_ScrollList">
  7.                     <Anchor point="TOPLEFT" offsetY="30" />
  8.                     <Anchor point="BOTTOMRIGHT" />
  9.                 </Control>
  10.             </Controls>
  11.         </TopLevelControl>
  12. ...
The line marked with *** creates the scroll container you need, it inherits from ZO_ScrollList which contains all the components. And since it's so stupid to write about code we all have installed, here's how it's defined:
xml Code:
  1. <!--Scroll List-->
  2.         <Control name="ZO_ScrollList" inherits="ZO_ScrollAreaBarBehavior" virtual="true">
  3.             <OnInitialized>
  4.                 ZO_ScrollList_Initialize(self)
  5.             </OnInitialized>
  6.  
  7.             <Controls>
  8.                 <Scroll name="$(parent)Contents" mouseEnabled="true">
  9.                     <Anchor point="TOPLEFT" />
  10.                     <Anchor point="BOTTOMRIGHT" offsetX="-16" />
  11.                     <OnMouseWheel>
  12.                         ZO_ScrollList_ScrollRelative(self:GetParent(), -delta * 40)
  13.                     </OnMouseWheel>
  14.                 </Scroll>
  15.                 <Slider name="$(parent)ScrollBar" mouseEnabled="true" inherits="ZO_VerticalScrollbarBase">
  16.                     <Anchor point="TOPLEFT" relativeTo="$(parent)Contents" relativePoint="TOPRIGHT" offsetY="16" />
  17.                     <Anchor point="BOTTOMLEFT" relativeTo="$(parent)Contents" relativePoint="BOTTOMRIGHT" offsetY="-16" />
  18.                     <OnMouseWheel>
  19.                         ZO_ScrollList_ScrollRelative(self:GetParent(), -delta * 40)
  20.                     </OnMouseWheel>
  21.  
  22.                     <OnValueChanged>
  23.                         ZO_ScrollList_MoveWindow(self:GetParent(), value)
  24.                     </OnValueChanged>
  25.                 </Slider>
  26.             </Controls>
  27.         </Control>

You see? By inheriting from ZO_ScrollList, you get a control which has a child named "Contents" where you put all the controls you want in the scrollable window. It's parent is your EventExplorerWindow->Scroll, thus the full name is EventExplorerWindowScrollContents.
  Reply With Quote
07/25/14, 05:40 AM   #23
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by merlight View Post
xml Code:
  1. <!--Scroll List-->
  2.         <Control name="ZO_ScrollList" inherits="ZO_ScrollAreaBarBehavior" virtual="true">
  3.             <OnInitialized>
  4.                 ZO_ScrollList_Initialize(self)
  5.             </OnInitialized>
  6.  
  7.             <Controls>
  8.                 <Scroll name="$(parent)Contents" mouseEnabled="true">
  9.                     <Anchor point="TOPLEFT" />
  10.                     <Anchor point="BOTTOMRIGHT" offsetX="-16" />
  11.                     <OnMouseWheel>
  12.                         ZO_ScrollList_ScrollRelative(self:GetParent(), -delta * 40)
  13.                     </OnMouseWheel>
  14.                 </Scroll>
  15.                 <Slider name="$(parent)ScrollBar" mouseEnabled="true" inherits="ZO_VerticalScrollbarBase">
  16.                     <Anchor point="TOPLEFT" relativeTo="$(parent)Contents" relativePoint="TOPRIGHT" offsetY="16" />
  17.                     <Anchor point="BOTTOMLEFT" relativeTo="$(parent)Contents" relativePoint="BOTTOMRIGHT" offsetY="-16" />
  18.                     <OnMouseWheel>
  19.                         ZO_ScrollList_ScrollRelative(self:GetParent(), -delta * 40)
  20.                     </OnMouseWheel>
  21.  
  22.                     <OnValueChanged>
  23.                         ZO_ScrollList_MoveWindow(self:GetParent(), value)
  24.                     </OnValueChanged>
  25.                 </Slider>
  26.             </Controls>
  27.         </Control>

You see? By inheriting from ZO_ScrollList, you get a control which has a child named "Contents" where you put all the controls you want in the scrollable window. It's parent is your EventExplorerWindow->Scroll, thus the full name is EventExplorerWindowScrollContents.
That is exactly the information I was missing. Before I understan code I cannot use it, as I could not debug it.
After some tests to get the name right I got it added to the proper container. But there are still two issues:
The ScrollBar starts out hidden (I forced it visible by calling SetHidden via Zgoo wich hands in nil).
And (propably releated) it is not not as scrolly as I picutred it to be:


As can be expected it cannot be dragged and does not react to mousewheel.
My guess is that the Scroll element caleld "Contents" is not properly aware of the size of it's contents. So it confines itself to Anchor size.
Attached Thumbnails
Click image for larger version

Name:	post.PNG
Views:	1392
Size:	358.8 KB
ID:	361  
  Reply With Quote
07/25/14, 06:04 AM   #24
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
ZO_ScrollList is much more complex template then ZO_ScrollContainer. If you are not going to use ZO_ScrollList functions it's much easier to use the ZO_ScrollContainer template.

For example if you want to add data to the ZO_ScrollList, you should use:
function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)

Working example is in pills' ScrollListExample addon which I have linked before.
  Reply With Quote
07/25/14, 11:57 AM   #25
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Garkin View Post
ZO_ScrollList is much more complex template then ZO_ScrollContainer. If you are not going to use ZO_ScrollList functions it's much easier to use the ZO_ScrollContainer template.
I would not say it is more complex. But hard to say as we don't have good documentation for either one.

Right now only one piece seems to be missing:
The scroll is not expanding to the summed size of the labels. This is just a basic layout issue (contaienr not aware of it's contents size), nothing more. Right now first Label is anchored with the Scroll, but all further ones are anchored with the previous labels. Maybe changing that up or directly overriding the Scrolls height based on the label count will deal with that.
If we just had something like a WPF Stackpannel it would be childs play to do this.
  Reply With Quote
07/25/14, 12:11 PM   #26
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
I'm just curious, but what will be the difference between this and the event viewer in Zgoo?
  Reply With Quote
07/25/14, 12:44 PM   #27
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Seerah View Post
I'm just curious, but what will be the difference between this and the event viewer in Zgoo?
Was not even aware zgoo could do that.
But it is more like a "all event log" where you have to explicitly unregister events (and cannot just easily turn them back on). If you want only a specific event to be tracked, you have a lot of excluding to do.

What are the differences?
You can explicilty register and unregister events at runtime.
It provides an overview of all Events so you can look wich ones are avalible at realtime.

As a side effect: I will also finally learn a bit about ESO UI XML.
Wich means I can afterwards make the wiki a bit newcommer friendly.
Maybe even make the odd usefull tool or two (this game UI could really use a StackPanel and similar containers).
  Reply With Quote
07/25/14, 12:58 PM   #28
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by zgrssd View Post
I would not say it is more complex. But hard to say as we don't have good documentation for either one.
If Garkin says it's more complex, I'd trust that ZO_ScrollList is actually so complex that ZOS documented it for themselves ^^

This is the (complete) documentation for ZO_ScrollContainer:
--Scroll Control - Encapsulates a scroll control with a scrollbar
This for ZO_ScrollList:
--Scroll List Control
--A scrollable list of controls that reuses controls as they scroll out of view.
--Use this control when you have a very large number of a couple different types of controls to display.
--To use:
--(1) Add a scroll list to your XML.
--(2) Add data types to the scroll list, one for each type of control. A data type includes an XML control template, a height, and a callback that can setup the control given data.
--(3) Add data to the scroll list. First, use GetDataList to get the table holding the data. Next, use CreateDataEntry to create a list element of a certain data type. You may pass
-- in an arbitrary piece of data that will be given to the setup callback when the control is shown. Once you have made as many data entries as you need, add them to the data
-- list in any way you want. Finally, call Commit to update the scroll list with your data.
-- Note: The scroll list can use faster update logic if all controls are the same height.
function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)
--Adds a new control type for the list to handle. It must maintain a consistent size.
--@typeId - A unique identifier to give to CreateDataEntry when you want to add an element of this type.
--@templateName - The name of the virtual control template that will be used to hold this data
--@height - The control height
--@setupCallback - The function that will be called when a control of this type becomes visible. Signature: setupCallback(control, data)
--@dataTypeSelectSound - An optional sound to play when a row of this data type is selected.
--@resetControlCallback - An optional callback when the datatype control gets reset.
Turns out I had ZO_ScrollContainer in mind the whole time, that's the simple container you put controls in.

With ZO_ScrollList, you have to supply a row setup function and raw data, and it creates the required row controls as it needs them. I think a good example is Inventory window. If you have 100 items, it probably doesn't contain 100 rows, but only as many as are simultaneously visible, and fills them with item data as you scroll.
  Reply With Quote
07/25/14, 02:28 PM   #29
Sephiroth018
 
Sephiroth018's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 20
Originally Posted by merlight View Post
If Garkin says it's more complex, I'd trust that ZO_ScrollList is actually so complex that ZOS documented it for themselves ^^

This is the (complete) documentation for ZO_ScrollContainer:


This for ZO_ScrollList:


function ZO_ScrollList_AddDataType(self, typeId, templateName, height, setupCallback, hideCallback, dataTypeSelectSound, resetControlCallback)


Turns out I had ZO_ScrollContainer in mind the whole time, that's the simple container you put controls in.

With ZO_ScrollList, you have to supply a row setup function and raw data, and it creates the required row controls as it needs them. I think a good example is Inventory window. If you have 100 items, it probably doesn't contain 100 rows, but only as many as are simultaneously visible, and fills them with item data as you scroll.
And I created nearly the same logic myself...
Btw, where did you get that from? There is nothing about that in the wiki.
  Reply With Quote
07/25/14, 03:00 PM   #30
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
That from client scripts.
  Reply With Quote
07/25/14, 04:00 PM   #31
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
There are some scripts (which likely violate the TOS) that you can find online and use to extract assets from the compressed data files. If you extract those, you can find existing LUA definitions (and documentation) of some of the ZOS functions and default UI and such.
  Reply With Quote
07/25/14, 05:14 PM   #32
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by Sasky View Post
There are some scripts (which likely violate the TOS) that you can find online and use to extract assets from the compressed data files.
Which is pretty absurd in my opinion - these files are not protected in any way other than legal rubbish. They could've been just zipfiles, or ZOS could've given addon developers an unpacker. Instead, people waste their time reversing data formats, writing their own unpackers (the simplest of which doesn't even need reversing anything). And as Sephiroth wrote, addon developers waste their time reinventing the wheels that are already there, so they have less time to develop something new for ESO.
  Reply With Quote
07/25/14, 05:39 PM   #33
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
I agree that closing down Addon development is counter-productive. It is in the TOS, however, and pursuing extraction of the .dat files could open you up to some sort of reprisal by Zenimax. Will they? Probably not. Could they? Yes.

Ideally they'd compile the documentation in some sort of Javadoc-style documentation and release that (instead of a list of functions) for the API. I mean, it takes all to 15 seconds in Google to find one exists (LuaDoc) and in a business-compatible license. I'd expect any SDE could get it setup and running in a couple hours and then for each release it'd only take probably 1 minute to re-run the script and update it -- less if they get it built-in as a target for the build/make script.
  Reply With Quote
07/25/14, 05:46 PM   #34
Halja
 
Halja's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 111
It maybe absurd but it is a violation of the TOS to extract the default UI code from the dat files. ZeniMax has not given written authorization to view it. It maybe a simple compression algorithm but you are decompiling the source code at your own risk to lose your ESO account. It is one thing to open a plain text file and something else when ZeniMax took the effort to obfuscate it even a little. You can call it legal rubbish all you want they still could deny you service for the violation.

It would be wonderful if they gave an approved de-packing tool and more documentation. It's been requested. The fine folks that host this site ask ZeniMax consistently if the default UI code can be publicly posted. The legal depart of ZeniMax continue to drag their feet on saying yes.
  Reply With Quote
07/25/14, 09:57 PM   #35
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
ESOUI has asked Zenimax if we could release the source code, and they have not ever gotten back to us with an answer.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Creating a whole bunch of Elements dynamic from code

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