Originally Posted by Cargor
Yeah, just looked at your complete code of the addon and noticed that your dropdown-creation was done in a function, so it doesn't matter where the other functions are defined. From the pastey it looked like it's directly executed on load
|
Yeah, sorry. Should've clarified that.
Is the data of activeProfile[frame].point every time available and not nil?
|
Yes, activeProfile data is always readily available for a frame.
By the way, as far as I know you can set the dropdown-entry-values directly to "BOTTOMLEFT" (and so on) instead of just numbers. This should simplify your code a lot.
|
To make sure I understand, I could simply replace
Code:
local point = activeProfile[frame].point
if point == "CENTER" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 0)
elseif point == "TOP" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 1)
elseif point == "TOPRIGHT" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 2)
elseif point == "RIGHT" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 3)
elseif point == "BOTTOMRIGHT" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 4)
elseif point == "BOTTOM" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 5)
elseif point == "BOTTOMLEFT" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 6)
elseif point == "LEFT" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 7)
elseif point == "TOPLEFT" then
UIDropDownMenu_SetSelectedValue(CFM_ToBox, 8)
end
with
Code:
local point = activeProfile[frame].point
UIDropDownMenu_SetSelectedValue(CFM_ToBox, point)
?
Would it be possible to clear data on show so that the dropdowns only show selected frame data onclick?
|
I shouldn't have to clear any data as the function is directly referencing my dropdowns and it's data only. At least, that's the way I understand it....
Gonna stick some debug print()'s in there and track the data assignments. Post back with results.