Thread: DBM sliders!
View Single Post
05-04-16, 01:02 PM   #2
Yukyuk
A Chromatic Dragonspawn
 
Yukyuk's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2015
Posts: 179
In DBM-GUI.lua

This part is used to create the silders.

Lua Code:
  1. -- This function creates a slider for numeric values
  2. --
  3. --  arg1 = text ontop of the slider, centered
  4. --  arg2 = lowest value
  5. --  arg3 = highest value
  6. --  arg4 = stepping
  7. --  arg5 = framewidth
  8. --
  9. do
  10.     local function onValueChanged(font, text)
  11.         return function(self, value)
  12.             font:SetFormattedText(text, value)
  13.         end
  14.     end
  15.     function PanelPrototype:CreateSlider(text, low, high, step, framewidth)
  16.         local slider = CreateFrame('Slider', FrameTitle..self:GetNewID(), self.frame, 'OptionsSliderTemplate')
  17.         slider.mytype = "slider"
  18.         slider.myheight = 50
  19.         slider:SetMinMaxValues(low, high)
  20.         slider:SetValueStep(step)
  21.         slider:SetWidth(framewidth or 180)
  22.         _G[FrameTitle..self:GetCurrentID()..'Text']:SetText(text)
  23.         slider:SetScript("OnValueChanged", onValueChanged(_G[FrameTitle..self:GetCurrentID()..'Text'], text))
  24.         self:SetLastObj(slider)
  25.         return slider
  26.     end
  27. end

On line 2275 in the same file (see below).
7 is the minimum font size.
18 is the maximum font size.
You guess the min, max values for the Bar Height

Lua Code:
  1. local FontSizeSlider = BarSetup:CreateSlider(L.Bar_FontSize, 7, 18, 1)
  2.         FontSizeSlider:SetPoint("TOPLEFT", BarSetup.frame, "TOPLEFT", 20, -175)
  3.         FontSizeSlider:SetScript("OnShow", createDBTOnShowHandler("FontSize"))
  4.         FontSizeSlider:HookScript("OnValueChanged", createDBTOnValueChangedHandler("FontSize"))
  5.  
  6.         local BarHeightSlider = BarSetup:CreateSlider(L.Bar_Height, 10, 35, 1)
  7.         BarHeightSlider:SetPoint("TOPLEFT", BarSetup.frame, "TOPLEFT", 20, -215)
  8.         BarHeightSlider:SetScript("OnShow", createDBTOnShowHandler("Height"))
  9.         BarHeightSlider:HookScript("OnValueChanged", createDBTOnValueChangedHandler("Height"))
  10. end
__________________
Better to fail then never have tried at all.

Last edited by Yukyuk : 05-04-16 at 01:10 PM.
  Reply With Quote