|
05/05/15, 03:12 PM | #1 | |
Join Date: Apr 2015
Posts: 20
|
ScrollListExample & Dropdown Windows
I'm having trouble understanding how ScrollListExample add on functions. I'm completely lost on the ZO_ScrollList and ZO_SortFilteredList functions. I can't even determine how/where the add on finds/inserts data into the window.
This seems a little more complex than a simple drop down but even that I'm having trouble. Looking at the GuildSelector.xml in the game files, I see a function call ZO_ComboBox_DropdownClicked(self:GetParent()), I don't see how this window is being populated with information. |
|
05/05/15, 03:53 PM | #2 |
I'm not sure if I'm telling you bull**** about the guildselector combobox but I'll try to explain what I understood how it works
The combobox in the guildselector.xml is named "$(parent)ComboBox". As the $parent is a placeholder for the "parent" control, which is the TopLevelControl "ZO_GuildSelector", this full name will be: ZO_GuildSelectorComboBox You could use the ZGOO addon inagme, go to the guild roster e.g where you can see the guild selector combobox. Now enter /zgoo ZO_GuildSelectorComboBox into the chat. You'll see a list of all functions and controls, children etc. of this combobox. At the function GetChildren(), if you expand it by the small ":" button, you can see 2 children where one is a label control and the other one is a button. The label will show the text/name of the guild, the button is the small triangel button right to the selector combobox. Hint: You can always use the function A__ZGoo_ToggleHidden() to toggle the visibility of elements to see which element you are currently looking at So where does the data of the combobox come from? You can see a table "m_comboBox" beyond the combobox control ZO_GuildSelectorComboBox. In there you'll find different functions and other tables, where one is holding the entries of the combobox: m_sortedItems The entries here must be somwhow "loaded" into the table. This must be done after the box has been created. Inside the XML file you'll find the following part beyond the combobox control: Code:
<OnInitialized> ZO_ComboBox:New(self) </OnInitialized> -> Somwhere this will trigger an event "EVENT_GUILD_DATA_LOADED", or at least this event will be used later on to populate the guild data. Maybe it is triggered as you open the guild roster. YoU'll have to search the other guild files for the event name to check in detail- lua file Together with the XML file there is a lua file in the same directory, with the same name: "guildselector.lua". In here you fnd additional source code, like the creation of the guild selector subclass (OO coding). At the cretion of this subclass the combobox will be assigned to the subclass, in function "function GuildSelector:New(control)" at line 7ff Lua Code:
In additon here is added an event listener for this event that we have talked about above, event "EVENT_GUILD_DATA_LOADED", see line 29: Lua Code:
As the event gets triggered the callback function InitializeGuilds() will be executed and this function is filling the combobox then finally for the first time. See lines 68ff: Lua Code:
|
|
05/05/15, 04:35 PM | #3 | |
Join Date: Apr 2015
Posts: 20
|
Holy crap that is a lot of functionality...
I'm going to attempt to create a simple example, create a combo box and make it display the data of a hard coded table. If someone more experienced beats me to it, please post it. I know im going to spend 80 years on this. |
|
05/05/15, 05:22 PM | #4 |
Basically you only need to create the combobox that you need, anchor it somehwhere to a parent control to show it and give it some entries.
You said you wish to have a table for this, let's call it myTable. And your combobox is named, let's say, myComboBox (created by help of XML or lua code): Lua Code:
|
|
05/10/15, 10:00 PM | #5 | |
Join Date: Apr 2015
Posts: 20
|
I know LAM is supposed to be used for addon settings menus but couldn't it be used in an add on just the same outside a settings option window to do the things I requested in this thread?
edit I still couldn't get a functional drop down. Last edited by stAjora : 05/10/15 at 10:05 PM. |
|
05/10/15, 10:15 PM | #6 |
Look at autoInvite he pushed it's lam2 panel into its window xml.
|
|
05/11/15, 04:04 AM | #7 | |
|
Did you want something like this? Code to create top level window, a background, & the comboBox:
Warning: Spoiler
Lua Code:
Code to populate the comboBox: There are a lot of ways to populate the comboBox, you can loop through a table and use CreateItemEntry to create the item entries for you like this:
Warning: Spoiler
Lua Code:
Code to call those functions to create the window/box, & populate it:
Warning: Spoiler
Lua Code:
Other ways to populate it: CreateItemEntry just creates a table from the data you pass it that looks like this:
Warning: Spoiler
Lua Code:
So if you wanted to store extra data with each item, you could create the entry yourself & just add the extra data like this:
Warning: Spoiler
Lua Code:
or if you create the itemEntries yourself you could let the game handle the loop & addItem(...) calls for you with:
Warning: Spoiler
Lua Code:
Last edited by circonian : 05/11/15 at 04:08 AM. |
|
05/12/15, 04:07 PM | #8 | |
|
https://github.com/sirinsidiator/ESO...ethods-on-LAM2 I use that extensively for the UI controls in AutoInvite. The group list and some of the buttons are separate, but most of the options are using LAM creation. This file has most of the control creation: http://git.esoui.com/?a=viewblob&p=A...s_fragment.lua For dropdown, it should be something like: Lua Code:
If you're familiar with LAM, it's (much) easier to setup this way. The only window manager stuff you need to get into is making sure you have a parent control and setting the anchor. On the downside, you don't have as much flexibility in terms of sizing. If the option-styling of LAM works for you, though, it's much easier to setup. |
|
06/03/15, 11:24 AM | #9 | |
|
Is this something like you are looking for?
http://www.esoui.com/downloads/info5...stExample.html Basically the data is assigned via tables in the initialization functions. I can't remember which one but it's either New or Initialize. I'll have to double check when I'm on a pc.
Last edited by Argusus : 06/03/15 at 11:27 AM. |
|
ESOUI » Developer Discussions » Lua/XML Help » ScrollListExample & Dropdown Windows |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Switch to Linear Mode |
Hybrid Mode |
Switch to Threaded Mode |
|
|