Closed 1ForeverHD closed 5 months ago
I've tried adding my own way of creating a TextBox but it just breaks the entire TopbarPlus and only basic icons are created. How would I properly go about actually adding it?
It'll likely involve converting the TextLabel into a TextButton, then a few other possible tweaks:
https://github.com/1ForeverHD/TopbarPlus/blob/main/src/Icon/TopbarPlusGui.lua
https://github.com/1ForeverHD/TopbarPlus/blob/main/src/Icon/init.lua
I've done exactly what you have done to try to make a normal TextLabel. There are no output errors.
I've checked everything by simply searching for strings of text in the editor repeating anything for a TextLabel but changing whatever I need into a TextBox. Just turns into into this:
The open dropdown is the UI I made before the TextBox stopped making it work. By any chance, would attempting to override the TextLabel work for this method or would trying to find a way to format the TextLabel into a TextBox work better?
Between the gap at line 64 of TopbarPlusGui (ensuring a completely new clean module) add the following:
local iconBox = Instance.new("TextBox")
iconBox.BackgroundTransparency = 1
iconBox.Name = "IconBox"
iconBox.AnchorPoint = Vector2.new(0, 0.5)
iconBox.Position = UDim2.new(0.5, 0, 0.5, 0)
iconBox.Text = ""
iconBox.RichText = true
iconBox.TextScaled = false
iconBox.ClipsDescendants = true
iconBox.ZIndex = 11--3
iconBox.Parent = iconButton
iconBox.Active = false
iconBox.Visible = false
Then for every icon you wish to convert into a TextBox, do the following:
local function convertToTextBox(icon)
icon:setInstance("iconLabel", icon.instances.iconButton.IconBox)
icon:_updateAll()
icon:lock()
end
Icon.new()
:give(convertToTextBox)
In the future I'll introduce a method to handle all of this, likely called 'convertLabelToTextBox'
icon:convertLabelToTextBox
Also note that in future versions, the :give
method will be renamed to :call
.
I never realized you were able to make your own functions and give them to the icon itself. Anyways, thanks for the help on this.
This will not be added for v3 due to limited popularity
convertLabelToTextBox
. See following for more details: https://devforum.roblox.com/t/topbarplus-v2-construct-intuitive-topbar-icons/1017485/129