LibAddonMenu update optionsData
I have a situation where I want to do may not be possible. I want to be able to dynamically update the optionsData. I have looked at the wiki at https://github.com/sirinsidiator/ESO-LibAddonMenu/wiki but I can't see what I am looking for. Maybe I am looking in the wrong spot. Any help would be appreciated. Here is what I am trying to accomplish.
Say I have a dropdown list with the following values: Blue, Green, Red, Yellow. When the person selects a color, that color is no longer available. So if the person selects Red, then the new dropdown values should be Blue, Green, Yellow. Red is no longer available because it has already been "used." I am not asking about the functions that are processing the choice, I am asking how to I tell LAM that there is an updated optionsData table to use? Am I asking the impossible? I did find a similar post https://www.esoui.com/forums/showthr...t=LibAddonMenu. I kinda understand, but my little brain could not figure out exactly what all that meant. Is there somewhere that has a nice simple working example I can learn from? |
The dropdown uses a table for the values. A table can be altered but that would mean manipulating the table used. I'm not sure that is impossible but probably not what is intended.
https://github.com/sirinsidiator/ESO.../wiki/Controls |
Quote:
|
Granted I'm not going in game and doing this to test but unless LAM can't use the new table once you initialize it then I don't see why LAM wouldn't use the modified table.
Code:
function ManipulateTable() |
When I first call LAM:RegisterOptionControls(panelName, optionsData), it will create the menu properly, with all the colors listed, but when I change the options in the dropdown table and try calling LAM:RegisterOptionControls(panelName, optionsData) a second time, it still uses the old table, not my new one.
|
I don't see why you would have to call RegisterOptionControls() more than once. If what I am suggesting doesn't work then you will have to wait for the author to respond. (He is in another time zone)
|
Found this thread, so it looks like it is not possible to do what I want. https://www.esoui.com/forums/showthr...t=LibAddonMenu
Quote:
|
That answer in that other thread was regarding adding and removing new controls to the menu. As long as you just want to update the existing controls, that's supported.
You simply have to tell LAM that you have changed something in the data table, otherwise it wouldn't know that the dropdown choices are now different: Lua Code:
|
Lua Code:
This code randomizes MyAddonDropdown items every time you select something. |
Sirinsidiator just gave an example of what could be used.
|
@ShadowMau
If you want to work with 2 lists where 1 contains entries, and if you select some they will be moved to the other 2nd list (of chosen entries), have a look at LibShifterBox. It is not added to LAM directly but you can easily use LibAddonMenu's customControl type (the SetpFunction callback) to add a LibShifterBox to your addon settings panel. |
Baertram he wants to use a dropdown that is dynamically rebuilt depending on which choices have been used. He doesn't want people to choose the same option twice.
|
Quote:
I'm only pointing to the possibilities there, whatever will be chosen to be used in the end is up to ShadowMau. |
Thank You
Thank you all for your ideas and suggestions. Between @sirinsidiator telling me about :UpdateChoices, and the example from @andy.s I learned what I needed to make what I wanted to do work.
Also thank you to @Baertram, you have been very helpful. This was just a proof of concept example so your LibShifterBox does not apply to what I am trying to do with my actual application. I will, however, be downloading LibShifterBox and taking a look at it so I can learn more. |
For those who are interested, what I learned was ultimately used in LinkPetToMount. I then turned around an used the same idea for FavoritePet and FavoriteMount. For both FavoritePet and FavoriteMount, I could also have used the LibShifterBox.
|
All times are GMT -6. The time now is 10:41 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI