Dominos

Dominos

19M Downloads

Resizing menus

Goranaws opened this issue ยท 3 comments

commented

I was just trying to change a width slider for the XP bar, and I found that it kept skipping over the exact number I wanted. After about ten minutes of messing around, I was able to add a button to the bottom of ALL the menus that allows the user to resize any menu. The neat thing is that since you have the frame's dimension set to reset each the the menu is opened, resizing a frame has no long-term effects. Also, by resizing the menu I was using, I was able to select the number I was after.

The coding additions are simple. All but the last one gets added into menu.lua located in Dominos_Config
First, add the following in at line 75

f.ResizeButton =  CreateFrame("Frame", f:GetName().."ResizeButton", f)
f.ResizeButton:EnableMouse(true)
f.ResizeButton.tex = f.ResizeButton:CreateTexture(f.ResizeButton:GetName() .. "Grip")
f.ResizeButton.tex:SetTexture("Interface/BUTTONS/UI-AutoCastableOverlay")
f.ResizeButton.tex:SetTexCoord(0.619, 0.760, 0.612, 0.762)
f.ResizeButton.tex:SetDesaturated(true)
f.ResizeButton.tex:ClearAllPoints()
f.ResizeButton.tex:SetAllPoints(f.ResizeButton)
f.ResizeButton:SetWidth(16)
f.ResizeButton:SetHeight(16)
f.ResizeButton:SetScript("OnMouseDown", function(self)
    f:SetResizable(true)
    self:GetParent():StartSizing()
end)
f.ResizeButton:SetScript("OnMouseUp", function(self)
    self:GetParent():StopMovingOrSizing()
    f:SetResizable(false)
end)
f.ResizeButton:ClearAllPoints()
f.ResizeButton:SetPoint("BOTTOMRIGHT", -3, 4)
f.ResizeButton.tooltipText = "Click and drag to resize Menu."
f.ResizeButton:SetScript("OnEnter", function(self)
    self.tex:SetDesaturated(false)
    GameTooltip_AddNewbieTip(self, self.tooltipText, 1.0, 1.0, .0, self.newbieText)
end)
f.ResizeButton:SetScript("OnLeave", function(self)
    GameTooltip:Hide()
    self.tex:SetDesaturated(true)
end)

Next, add the following between line 112 and line 113

        self:SetMinResize((max(200, panel.width + self.extraWidth)), (max(40, panel.height + self.extraHeight)))

        panel:SetScript("OnSizeChanged", function(self, w, h)   
            panel.child = { self:GetChildren() };
            for _, child in ipairs(panel.child) do
                local name = child:GetName()
                if name and name:match('(%w+)Slider$') then
                    child:SetWidth(w-40)
                end
            end
        end)

next change line 315 to the following

local slider = CreateFrame('Slider', name.."Slider", self, 'OptionsSliderTemplate')

and this one is added into ActionBar.lua

change line 588 to

_G[self:GetParent():GetName() .. L.Columns.."Slider"]:OnShow()

commented

Nope, but many people (like me) don't realize such simple things till they are pointed out. :P

commented

That, and it took less than ten minutes to figure out the sizing thing. so no worries and no time wasted. :P

commented

If I told you that you can do precise numbers via mouse-wheel, would you hate me? :)