Thread Tools Display Modes
04-14-17, 09:55 AM   #1
Elderin
A Deviate Faerie Dragon
Join Date: Nov 2012
Posts: 17
Smile Drop Down Menu

I'm trying to implement a drop down menu based on the example at http://wow.gamepedia.com/Using_UIDropDownMenu.

Looking at the example menu image shown with the section "A Complete Example", is it possible to change the border of the drop down frames?

The example uses a function, "function dropDown:SetValue(newValue)", which appears to be a global function. Must it be global? Just trying to save myself the experimentation headaches in case someone already knows.

Or, perhaps there is a better example than the one on gamepedia. I will say that I am trying to stay away from libraries like Ace's and I'm hoping to eliminate as much global pollution as possible.
  Reply With Quote
04-16-17, 12:48 AM   #2
Gethe
RealUI Developer
 
Gethe's Avatar
Premium Member
Featured
Join Date: Sep 2008
Posts: 942
Code:
function dropDown:SetValue(newValue)
This is not global, it is setting a function to the key "SetValue" on your local "dropDown" table. The structure is essentially this:
Code:
local dropDown = {
    SetValue = function(self, newValue)
    end
}
The example is also using the colon syntax to define the function. This provides the function an implicit self argument. Corona Labs has a good tutorial covering colon vs dot syntax.
__________________
Knowledge = Power; Be OP

  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Drop Down Menu


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off