1. I want to have a few drop down menus in the addon I'm working on. I read the chaper about drop down menus, and that will work but I noticed the default UI options panels have combo boxes for their drop down menus. I looked through the options panel xml and lua files. I didn't see anything about the combo box. Does anyone know where the code and graphics files they use for combo boxes is/are?

     

    Example combo box in Java:

    http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html

    A combo box is a special button that has the current selection shown with a "down arrow" button that triggers the drop down menu to show. The user can click on a button in the menu to make a selection. There can only be one item selected at a time.

    I want to have a few drop down menus in the addon I'm working on. I read the chaper about drop down menus, and that will work but I noticed the default UI options panels have combo boxes for their drop down menus. I looked through the options panel xml and lua files. I didn't see anything about the combo box. Does anyone know where the code and graphics files they use for combo boxes is/are?

     

    Example combo box in Java:

    http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html

    A combo box is a special button that has the current selection shown with a "down arrow" button that triggers the drop down menu to show. The user can click on a button in the menu to make a selection. There can only be one item selected at a time.

    It would help if you could point out what specific elements you are looking at in the default UI.. and then both you and I can go look at the code for those elements.  Either their combo boxes are implemented using the dropdown interface, or they're done manually.  I don't know which specific case you are referring to, so I can't say more than that.

    Load any character in the game and open the Interface Options. In the Controls panel at the very bottom, is a combo box + drop down for setting the autoloot key. The lua and xml for this appears to be FrameXML\UIOptionsPanels.lua and FrameXML\UIOptionsPanels.xml. They have commented before each panel so it was easy to find the Control panel area. I saw where they use the drop down template, which is shown in the book. I could not find anything that had to do with the combo box. They go from a CheckButton for the AutoLootCorpse option to the drop down box for AutoLootKey like somehow the UIDropDownTemplate includes a combo box. When I use the template it just creates the little drop down and no combo box. I have not been able to find any addons that replicate the default UI combo box.

    I think there's a terminology issue here.  I know you're referring to a "Combo box" in the java sense, but that doesn't exist in World of Warcraft.  What you are seeing is JUST a dropdown menu.



    I use this sort of dropdown menu in most of my addons (TomTom, Clique).  The chapter on Dropdown menus shows precisely how to create this sort of menu, although the material there is slightly out of date due to changes in 3.x.  It does show how to create those menus with screenshots and code.  Please let me know if you have further questions.

    It's just a dropdown menu where you can click any of the items

    Ok, I followed the chapter in the book. The drop down is 2 separate parts, a button and a drop down menu. Clicking the button triggers display of the menu. In the book, the button inherits GameMenuButtonTemplate. The button ends up looking like the Okay button in your screenshot there. Is there some template that will create the combo box button?

    The drop down menu template just creates the pop-up menu. It doesn't create the button to trigger this menu, or at least, the method shown in the book doesn't show how to use the template to create that combo box. Look at page 314 of the book, Figure 23-3. There's a regular game button that you click to show a drop down menu. There is no combo box. I will try looking at your addons too.

    I've added a new snippet which creates a new dropdown buttton/menu using the API. You can find it here: Creating a ui-styled dropdown selection box.

    Thanks. That was exactly what I needed.

    Glad I was able to assist!

    I realize I'm picking up on an old thread, but perhaps you wouldn't mind giving this a glance. Essentially, it's a replica of your snippet code, but modified for my own data. The problem is that I can get all of it show/work EXCEPT the value changing on click. I trimmed the code down to one relevant menu item for trouble shooting, but there will be multiple. For some reason it doesn't like the generic initialization function I have. However, if I remove the Init function and make the calls to UIDropDownMenu.... line by line (for each menu button /ugh) it seems to work.

     p1=CreateFrame("Button", "p1", f.content, "UIDropDownMenuTemplate")
     p1:SetPoint("TOPLEFT", 20, -20)
     p1:Show()
    
     local prioritiesList={"A", "B", "C", "D", "None"}
    
     local function OnClick(self)
        UIDropDownMenu_SetSelectedID(self, self:GetID())
     end
    
     local function initialize(self, level)
        local info=UIDropDownMenu_CreateInfo()
        for k,v in pairs(prioritiesList) do
           info=UIDropDownMenu_CreateInfo()
           info.text=v
           info.value=v
           info.func=OnClick
           UIDropDownMenu_AddButton(info, level)
        end
     end
    
     --for generic initialization
     local function Init(btn)
        UIDropDownMenu_Initialize(btn, initialize)
        UIDropDownMenu_SetWidth(btn, 120)
        UIDropDownMenu_SetButtonWidth(btn, 124)
        UIDropDownMenu_SetSelectedID(btn, 1)
        UIDropDownMenu_JustifyText(btn, "LEFT")
     end
    
     Init(p1)
    

    Any input on where either logic or syntax is failing me would be appreciated.

    I do not see any obvious errors. Does my snippet code still work if you drop it into WowLua verbatim?

    Yes, your snippet still works. I really fail to see where the issue is, but there must be one. #annoyingmoments

    As for the code I entered, it will show 'A' in the menu box, display the menu box on click with all items showing, allow click on any option, but 'A' will always remain listed in the menu box. /sigh

    The greater lesson learned is to not use unnecessary objects/code. I realized I could achieve the same end result with a few simple check buttons.