CreateDropDownMenu (Function)

From Legacy Roblox Wiki
Jump to navigationJump to search
CreateDropDownMenu( table items, function onItemSelected )
Returns Instance guiContainer, function updateSelection
Description: First argument should be a table full of strings that will populate menu. Second argument should be a function that takes one argument, and is called when a user selects a new object in the drop down menu. Returns 2 results, a gui container to the gui object and a updateSelection function for external updating. The container is a drop-down-box created around a list of items.


local videoNames = {} local videoNameToItem = {} videoNames[1] = "Just Save to Disk" videoNameToItem[videoNames[1]] = Enum.UploadSetting["Never"] videoNames[2] = "Upload to YouTube" videoNameToItem[videoNames[2]] = Enum.UploadSetting["Ask me first"]

local videoCaptureDropDown = nil videoCaptureDropDown, updateVideoCaptureDropDownSelection = RbxGui.CreateDropDownMenu(videoNames,

       function(text) 

print("do something here when " .. text .. " option is selected") end)

videoCaptureDropDown.Name = "VideoCaptureDropDown" videoCaptureDropDown.ZIndex = baseZIndex + 4 videoCaptureDropDown.DropDownMenuButton.ZIndex = baseZIndex + 4 videoCaptureDropDown.DropDownMenuButton.Icon.ZIndex = baseZIndex + 4 videoCaptureDropDown.Position = UDim2.new(0, 270, 0, 94) videoCaptureDropDown.Size = UDim2.new(0,200,0,32) videoCaptureDropDown.Parent = gameSettingsMenuFrame

</syntaxhighlight>
CreateDropDownMenu Example

See Also