1. #1

    Lightbulb Dropmenu with scroll

    Hello folks, I was wondering if someone can help me to improve an addon here.

    I've been a HandyNotes user for a long time now, have many many notes across my world map about all the cool things I've discovered in years of exploration across Azeroth, at some point I decided to create my own custom icons for HandyNotes since some good gentlemen in this forum helped me to tweak the source code to make the addon read the icons of a list in a custom folder instead of the default ones it comes with http://www.mmo-champion.com/threads/...p-notes-addon)...

    but... here's the problem:

    I made around 50 icons to document several different things in the maps (cause I'm a freak and like to add little pieces of customized information and curiosities in my maps) but the dropdown list in HandyNotes I think was never meant to include so many icons, leaving me with a huge vertical list that becomes annoying to handle, therefore I thought that the dropmenu list needs a fixed height and a scroll, that way the long list would become easy to handle. Something like:



    I know this is not my addon but the current maintainer on Curse.com seems to be on a break or vacation from wow, I'd really like to improve this little addon I like so much but I don't know LUA on a pro level to do so.

    I've managed to isolate the code chunk I think (I might be totally wrong tho) needs to be modified to add this feature and although I don't know if this is even possible at least I want to try and ask other fellow players about it.

    Code:
    -- Create the Icon Dropdown
    HNEditFrame.icondropdown = CreateFrame("Frame", "HandyNotes_IconDropDown", HNEditFrame, "UIDropDownMenuTemplate")
    HNEditFrame.icondropdown:SetPoint("TOPLEFT", HNEditFrame.descframe, "BOTTOMLEFT", -17, 0)
    HNEditFrame.icondropdown:SetHitRectInsets(16, 16, 0, 0)
    UIDropDownMenu_SetWidth(HNEditFrame.icondropdown, 120)
    UIDropDownMenu_EnableDropDown(HNEditFrame.icondropdown)
    HNEditFrame.icondropdown.displayMode = "MENU"
    HNEditFrame.icondropdown.texture = HNEditFrame.icondropdown:CreateTexture(nil, "OVERLAY")
    HNEditFrame.icondropdown.texture:SetWidth(12)
    HNEditFrame.icondropdown.texture:SetHeight(12)
    HNEditFrame.icondropdown.texture:SetPoint("RIGHT", HNEditFrame.icondropdown, -41, 2)
    HNEditFrame.icondropdown.text = HandyNotes_IconDropDownText
    HNEditFrame.icondropdown.text:SetPoint("RIGHT", HNEditFrame.icondropdown.texture, "LEFT", -3, 0)
    HNEditFrame.icondropdown.text:SetWidth(HNEditFrame.icondropdown.text:GetWidth() - 9)
    HNEditFrame.icondropdown.OnClick = function(button, value)
    	local t = HN.icons[value]
    	HNEditFrame.icondropdown.selectedValue = value
    	HNEditFrame.icondropdown.texture:SetTexture(t.icon)
    	if t.tCoordLeft then
    		HNEditFrame.icondropdown.texture:SetTexCoord(t.tCoordLeft, t.tCoordRight, t.tCoordTop, t.tCoordBottom)
    	else
    		HNEditFrame.icondropdown.texture:SetTexCoord(0, 1, 0, 1)
    	end
    	HNEditFrame.icondropdown.text:SetText(t.text)
    	local color = t.color
    	if color then
    		HNEditFrame.icondropdown.text:SetTextColor(color.r, color.g, color.b, color.a or 1)
    	else
    		HNEditFrame.icondropdown.text:SetTextColor(1, 1, 1, 1)
    	end
    end
    HNEditFrame.icondropdown.initialize = function(level)
    	wipe(info)
    	for i = 1, #HN.icons do
    		local t = HN.icons[i]
    		info.text = t.text
    		info.icon = t.icon
    		info.tCoordLeft = t.tCoordLeft
    		info.tCoordRight = t.tCoordRight
    		info.tCoordTop = t.tCoordTop
    		info.tCoordBottom = t.tCoordBottom
    		info.arg1 = i
    		info.func = HNEditFrame.icondropdown.OnClick
    		info.checked = HNEditFrame.icondropdown.selectedValue == i
    		info.keepShownOnClick = nil
    		UIDropDownMenu_AddButton(info)
    	end
    end

    This piece of code belongs to the HandyNotes_EditFrame.lua file in the addon's folder, this is the edit frame that pops up when you right click a note or create a new one with /hnnew or Alt + R.Click.

    I would forward the info and this thread to the addon comment section itself so the maintainer can add and improve it for everyone.

    Thanks in advance to anyone who can provide feedback to this.
    Last edited by Blakmane; 2017-01-18 at 04:34 PM.

  2. #2
    Any idea for this one? please D:

    T_T

  3. #3
    The default UIDropDownMenu implementation does not provide scrolling. The easiest solution would be to use nesting, like so:





    You'll have to rewrite the function where the menu is built, which is HNEditFrame.icondropdown.initialize. Here are some resources to get you going:

    https://wow.gamepedia.com/Using_UIDropDownMenu
    https://wow.gamepedia.com/UI_Object_UIDropDownMenu

  4. #4
    I see, I don't really know LUA in an expert level but seems like that kind of list is not the best option for HandyNotes if you want to add a long list of custom icons like the ones I made recently.



    Yeah I'm a map freak, I like to wander all over the maps and document anything interesting (lore places, treasures, Rare NPCs etc etc...), I like when I'm leveling an alt and a map note pops in the minimap with some interesting thing I left there with another toon... don't know.. is cool to me hehe.

    I'm no LUA expert so I'll pass the two links and the info you gave me to the creator of HN (hoping that person's reply) to see if the author could add this little feature as an improvement to a new version of the addon... who knows...

    Thanks Woogs!

  5. #5
    Of some relevance to the subject.
    I think the addon could do with an import/export feature, allowing players to share notes.
    Could offer for example new player guides via a forum post, highlighting locations they should be aware of such as vendors.
    Something I would be tempted to do is to try and add in the relevant locations on a per-profession basis, vendors/trainers/required "tool" locations such as the firmamant stone.
    Quote Originally Posted by DeadmanWalking View Post
    Your forgot to include the part where we blame casuals for everything because blizzard is catering to casuals when casuals got jack squat for new content the entire expansion, like new dungeons and scenarios.
    Quote Originally Posted by Reinaerd View Post
    T'is good to see there are still people valiantly putting the "Ass" in assumption.

  6. #6
    Quote Originally Posted by ComputerNerd View Post
    Of some relevance to the subject.
    I think the addon could do with an import/export feature, allowing players to share notes.
    Could offer for example new player guides via a forum post, highlighting locations they should be aware of such as vendors.
    Something I would be tempted to do is to try and add in the relevant locations on a per-profession basis, vendors/trainers/required "tool" locations such as the firmamant stone.
    Faaak... this is a magnificent idea man... being able to export notes like WeakAuras does would be the most amazing thing for the maps of this game... I mean... I have like 500+ notes on my maps... from Lore locations to treasures, toys drops, reagents farming spots, and so on, to the point I HAD to make my own icons so I could easily recognize all the different notes... being able to share that kind of things would be !@#$$#% AMAZING... is a shame the mantainer of HandyNotes seems to be missing in action right now...

  7. #7
    Sorry everybody for bother again with this but can anyone help me out to write a simple prototype of (let me quote Woogs, aka, a proper coder) "the function where the menu is built, which is HNEditFrame.icondropdown.initialize"

    A simple nested dropdown like the one Woogs suggested so I could add the icons I have to categories for example.
    I don't really know how to build something this complex really.

    And seriously ComputerNerd, that "share the note" option idea is sexy as fuck... hell notes could even have the author embeded at the end. I can imagine guilds sharing valuable information in the raid/dungeon maps like this... the possibilities are endless.

    Thanks anyway people!

  8. #8
    I'll rewrite it. Upload your custom version somewhere and send me a link.

    - - - Updated - - -

    Code:
    HNEditFrame.icondropdown.initialize = function(self, level, menuList)
    	local categories = UIDropDownMenu_CreateInfo()
    	wipe(info)
    	for i = 1, #HN.icons do
    		local t = HN.icons[i]
    		if ( level == 1 and t.category ~= nil and categories[t.category] == nil ) then
    			info.hasArrow = true
    			info.notCheckable = true
    			info.checked = nil
    			info.text = t.category
    			info.icon = nil
    			info.menuList = t.category
    			info.func = nil
    			info.arg1 = nil
    			UIDropDownMenu_AddButton(info)
    			categories[t.category] = 1
    		elseif ( t.category == menuList ) then
    			info.hasArrow = nil
    			info.notCheckable = nil
    			info.checked = HNEditFrame.icondropdown.selectedValue == i
    			info.text = t.text
    			info.icon = t.icon
    			info.menuList = nil
    			info.func = function(...) HNEditFrame.icondropdown.OnClick(...) CloseDropDownMenus() end
    			info.arg1 = i
    			UIDropDownMenu_AddButton(info, level)
    		end
    	end
    end

    Now you can add a category field to your icon tables and that icon will appear in a sub-menu under that name:

    Code:
    [10] = {category = "Profession", text = "Mining", icon = "Interface\\AddOns\\HandyNotes\\MapIcons\\Icon11.tga" },
    - - - Updated - - -

    Also, there were a lot of AceLocale errors in the version you sent me. You might want to think about updating to the newest version of HandyNotes if you can transfer all the custom alterations over.

  9. #9
    Thank you very much Woogs! Got it, let me get the latest version to add these mods. YOU ARE AWESOME!

  10. #10
    No prob. Make sure you backup your saved variables first.

  11. #11
    Quote Originally Posted by Woogs View Post
    No prob. Make sure you backup your saved variables first.

    $#%^ Awesome Woogs! Worked like a charm. Can customize the hell of it now, I can add 200 icons now if I want. Yo the best!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •