Hey all. I'm fairly new to LUA programing (but not to programing in general) and I'm having an odd issue with a drop down menu in my addon's config screen that I'm hoping someone can shed some light on.
I'm using the UIDropDownMenuTemplate as the basis. Everything is working fine, except the button for the drop down menu is not large enough to hold the wider choices. The dropdown menu itself IS, it's just the button that is too narrow. I've tried two methods and three code positions to adjust it. None are working. I've reviewed every reference I can find on the UIDropDownMenu functionality and, according to them, either of these should work.
UIDropDownMenu_SetButtonWidth has no effect at all.
ConfigFontStyle:SetWidth, in both the places I've tried it, has the effect of causing the entire button to shift to the left 200 pixels as if I was setting an offset from an anchor point.
I'm going around in circles with this. It's just a cosmetic issue, but it looks sloppy!
Note: fonttable is simply a table with a list of fonts and nicely formatted names for them.
Code:
local ConfigFontStyleLabel = config:CreateFontString( nil, "ARTWORK", "GameFontHighlight" );
config.ConfigFontStyleLabel = ConfigFontStyleLabel;
ConfigFontStyleLabel:SetPoint( "BOTTOMLEFT" , time,0,-40);
ConfigFontStyleLabel:SetText( "|c00dfb802Font Style" );
ConfigFontStyleLabel:Show();
local ConfigFontStyle = CreateFrame("Frame", "MyAddon_FontPick", config, "UIDropDownMenuTemplate");
config.ConfigFontStyle = ConfigFontStyle;
ConfigFontStyle:SetPoint("RIGHT", ConfigFontStyleLabel,30, 0);
--ConfigFontStyle:SetWidth(200);
ConfigFontStyle.initialize = function ()
ConfigFontStyle:SetWidth(200); -- Let's try this here.
for i,v in ipairs(fonttable) do
local fname, ffont = unpack(v);
info = UIDropDownMenu_CreateInfo()
info.text = fname;
info.func = config.ChangeFont;
info.value = ffont;
if(WhisperNotify_Config.Font == info.value) then
info.checked = true;
else
info.checked = false;
end
UIDropDownMenu_AddButton(info)
end --for
end;
UIDropDownMenu_Initialize(ConfigFontStyle, ConfigFontStyle.initialize)
UIDropDownMenu_SetSelectedValue(ConfigFontStyle,MyAddon_Config.Font );
-- UIDropDownMenu_SetButtonWidth(ConfigFontStyle, 200);