View Single Post
05/15/23, 10:58 AM   #3
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Your choices will be build once as the dropdown is created, as the menus opens.
If you want to update that later one, after changing the dropdown's selected entry, you need to update that table and re-assign it via dropdown:UpdateChoices(choices, choicesValues, choicesTooltips) function.

Provide a reference to your LAM dropdwn so you can access it after it was created, e.g.in your data table of that dropdown add
reference = "MyAddon_LAM_Dropdown1",

Then crete a small fucntion e.g.
Code:
local function updateMyChoices()
  if MyAddon_LAM_Dropdown1 == nil then return end
  local myChoices = {
    [1]=var1,
    [2]=var2,
    [3]=var3,
 }
 local myChoicesValues = {
    [1]=value1,
    [3]=value2,
    [2]=value3,
 }
 MyAddon_LAM_Dropdown1:UpdateChoices(myChoices, myChoicesValues )
end
At your setFunc of the dropdown change the value in the SV and after that call the func updateMyChoices() then.
Something like that.


This is only needed if your dropdown choices should cange based on the SV you change via that dropdown, so take care what you reference! e.g. do not reference the SAME SV variable in teh choices directly which you change via the same dropdown!

Last edited by Baertram : 05/15/23 at 11:00 AM.
  Reply With Quote