I created a dock widget plugin, but I can’t get each label and checkbox to appear separately with some sort of gap in between.
Code :
local LabeledCheckbox = require(script.Parent.StudioWidgets.LabeledCheckbox)
local AutoScanCheckbox = LabeledCheckbox.new(
"Auto", -- name suffix of gui object
"Auto-Scan enabled", -- text beside the checkbox
plugin:GetSetting("AutoScan"), -- initial value
false -- initially disabled?
)
AutoScanCheckbox:SetValueChangedFunction(function(newValue)
plugin:SetSetting("AutoScan",newValue)
end)
local currentValue = AutoScanCheckbox:GetValue()
-- disables and forces a checkbox value
AutoScanCheckbox:DisableWithOverrideValue(false)
if (AutoScanCheckbox:GetDisabled()) then
AutoScanCheckbox:SetDisabled(false)
end
-- return the label or button frames
--print(checkbox:GetLabel())
--print(checkbox:GetButton())
-- use :GetFrame() to set the parent of the LabeledCheckbox
AutoScanCheckbox:GetFrame().Parent = widget
local AdvancedScan = LabeledCheckbox.new(
"Advanced", -- name suffix of gui object
"Advanced Scan enabled", -- text beside the checkbox
plugin:GetSetting("AdvancedScan"), -- initial value
false -- initially disabled?
)
AdvancedScan:SetValueChangedFunction(function(newValue)
plugin:SetSetting("AdvancedScan",newValue)
end)
AdvancedScan:GetFrame().Parent = widget
The only things I changed are :
In GuiUtilities.lua :
--Lines 18 -20
module.kCheckboxMinLabelWidth = 44 -- was 55
module.kCheckboxMinMargin = 40 -- was 12
module.kCheckboxWidth = 20 --was 12
--Lines 203 - 208 :
-- only added size parameter.
function module.MakeStandardPropertyLabel(text, opt_ignoreThemeUpdates,size)
local label = Instance.new('TextLabel')
label.Name = 'Label'
label.BackgroundTransparency = 1
label.Font = Enum.Font.SourceSans
label.TextSize = size
In the LabeledCheckbox.lua :
-- LabeledCheckbox.lua
-- Creates a frame containing a label and a checkbox.
----------------------------------------
GuiUtilities = require(script.Parent.GuiUtilities)
local kCheckboxWidth = GuiUtilities.kCheckboxWidth
local kMinTextSize = 15 -- was 14
local kMinHeight = 60 ---24
--line 56 : local label = GuiUtilities.MakeStandardPropertyLabel(labelText, true, 30)