Thread Tools Display Modes
Yesterday, 02:52 PM   #1
Amakesh
Join Date: Oct 2021
Posts: 1
Unhappy Popup with controls

I would like the
Code:
AddCustomMenuItem(
    "Change Label Color",
    function()
        local color = nil

        color = unpack(self.labelSettings.labelColor)

        COLOR_PICKER:Show(
            function(...)
                self:SetLabelColor(...)
            end,
            color
        )
    end
)
method to show me a popup with two dropdowns and one slider instead of the colorpicker. Unfortunately, no matter which way I try, I always get just a popup with title, maintext and cancel and ok buttons.
What can I do to get the aforementioned controls in the window as well?
I tried both ZO_Dialogs(see example below) and libDialog.


Code:
	ZO_Dialogs_RegisterCustomDialog("ExampleDialog", {

		setup = function(dialog)
			d("Setting up dialog controls")
	
			local parentControl = dialog.control
			local slider = CreateControlFromVirtual("$(parent)Slider", parentControl, "ZO_Slider")
	
			if slider then
				slider:SetAnchor(TOPLEFT, parentControl, TOPLEFT, 0, 20)
				slider:SetMinMax(0, 100)
				slider:SetValue(50)
				slider:SetValueStep(1)
				slider:SetHandler("OnValueChanged", function(_, value)
					d("Slider value: " .. value)
				end)
				
				dialog.slider = slider
			else
				d("Failed to create slider.")
			end
		end,

		title = {
			text = "Example Dialog",
		},
		mainText = {
			text = "Adjust the slider:",
		},
	
		buttons = {
			{
				text = "OK",
				callback = function(dialog)
					d("Confirmed with slider value: " .. dialog.slider:GetValue())
				end,
			},
			{
				text = "Cancel",
				callback = function(dialog)
					d("Dialog cancelled")
				end,
			},
		},
	})
	

SLASH_COMMANDS["/showdialog"] = function()
    ZO_Dialogs_ShowDialog("ExampleDialog")
end

Last edited by Amakesh : Yesterday at 02:56 PM.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Popup with controls

Thread Tools
Display Modes

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