Hello.
For example we have this dropdown menu.
Lua Code:
HWGA = {}
HWGA.Checkboxes = {
title = "Select checkboxes",
menu = {
Key_1 = "Value 1",
Key_2 = "Value 2",
Key_3 = "Value 3",
Key_4 = "Value 4",
Key_5 = "Value 5",
}
}
HWGA.ActiveCheckboxes = {}
function HWGADropDown_SetFlag(self, flag_name)
if HWGA.ActiveCheckboxes[flag_name] then
HWGA.ActiveCheckboxes[flag_name] = nil;
self.checked = false;
else
HWGA.ActiveCheckboxes[flag_name] = true;
self.checked = true;
end
end
function HWGADropDown_Initialize(self)
local info = UIDropDownMenu_CreateInfo();
info.text = HWGA.Checkboxes .title;
info.isTitle = true;
info.notCheckable = true;
UIDropDownMenu_AddButton(info);
for flag_name, flag_value in pairs(HWGA.Checkboxes.menu) do
info = UIDropDownMenu_CreateInfo();
info.text = flag_name;
info.value = flag_value;
info.checked = HWGA.ActiveCheckboxes[flag_name];
info.func = HWGADropDown_SetFlag;
info.arg1 = flag_name;
info.isNotRadio = true;
info.keepShownOnClick = true;
UIDropDownMenu_AddButton(info);
end
end
local drp_dwn_button = CreateFrame("Button", "HereWeGoAgainDropDownButton", UIParent, "TooltipBackdropTemplate");
drp_dwn_button:SetSize(200, 40);
drp_dwn_button:SetPoint("CENTER", UIParent, "CENTER", 0, 0);
drp_dwn_button:SetScript("OnMouseDown", function(self) ToggleDropDownMenu(1, nil, HereWeGoAgainMenuDropDown, self, 0, 0) end);
local text = drp_dwn_button:CreateFontString(nil, "OVERLAY", "GameFontNormal");
text:SetPoint("CENTER", drp_dwn_button, "CENTER", 0, 0);
text:SetText(HWGA.Checkboxes.title);
local drp_dwn_frame = CreateFrame("Frame", "HereWeGoAgainMenuDropDown", nil, "UIDropDownMenuTemplate");
UIDropDownMenu_Initialize(drp_dwn_frame, HWGADropDown_Initialize, "MENU")
Is there is any simple way to change background color/opacity only for this dropdown?
In example, I want this:
I've found only one way to do it, but it changes
every dropdown in a game, because it's in dependecies with DropDownList:
Lua Code:
local BlackLayout = {
["TopRightCorner"] = {atlas = "Tooltip-NineSlice-CornerTopRight"},
["TopLeftCorner"] = {atlas = "Tooltip-NineSlice-CornerTopLeft"},
["BottomLeftCorner"] = {atlas = "Tooltip-NineSlice-CornerBottomLeft"},
["BottomRightCorner"] = {atlas = "Tooltip-NineSlice-CornerBottomRight"},
["TopEdge"] = {atlas = "_Tooltip-NineSlice-EdgeTop"},
["BottomEdge"] = {atlas = "_Tooltip-NineSlice-EdgeBottom"},
["LeftEdge"] = {atlas = "!Tooltip-NineSlice-EdgeLeft"},
["RightEdge"] = {atlas = "!Tooltip-NineSlice-EdgeRight"},
["Center"] = {layer = "BACKGROUND", atlas = "ui-frame-party-backgroundtile", x = -4, y = 4, x1 = 4, y1 = -4}
}
NineSliceUtil.ApplyLayout(DropDownList1MenuBackdrop, BlackLayout )
I didn't find any similar threads, but it seems to me that this question was of interest to many people.
I've tried SetBackdrop/different layouts, but it is not working. What I'm doing wrong?