Skip to content
This repository was archived by the owner on Aug 20, 2024. It is now read-only.

Commit 622cb62

Browse files
committed
Added multi line support and auto size.
1 parent 431a3b9 commit 622cb62

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/Workspace/SignsInternal/StudioWidgets/LabeledTextInput.lua

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
GuiUtilities = require(script.Parent.GuiUtilities)
99

1010
local kTextInputWidth = 100
11+
local kTextInputHeight = 18
1112
local kTextBoxInternalPadding = 4
1213

1314
LabeledTextInputClass = {}
@@ -29,6 +30,7 @@ function LabeledTextInputClass.new(nameSuffix, labelText, defaultValue)
2930
local defaultValue = defaultValue or ""
3031

3132
local frame = GuiUtilities.MakeStandardFixedHeightFrame('TextInput ' .. nameSuffix)
33+
frame.AutomaticSize = Enum.AutomaticSize.Y
3234
self._frame = frame
3335

3436
local label = GuiUtilities.MakeStandardPropertyLabel(labelText)
@@ -40,10 +42,10 @@ function LabeledTextInputClass.new(nameSuffix, labelText, defaultValue)
4042
-- Dumb hack to add padding to text box,
4143
local textBoxWrapperFrame = Instance.new("Frame")
4244
textBoxWrapperFrame.Name = "Wrapper"
43-
textBoxWrapperFrame.Size = UDim2.new(0, kTextInputWidth, 0.6, 0)
44-
textBoxWrapperFrame.Position = UDim2.new(0, GuiUtilities.StandardLineElementLeftMargin, .5, 0)
45-
textBoxWrapperFrame.AnchorPoint = Vector2.new(0, .5)
46-
textBoxWrapperFrame.AutomaticSize = Enum.AutomaticSize.X
45+
textBoxWrapperFrame.Size = UDim2.new(0, kTextInputWidth, 0, kTextInputHeight)
46+
textBoxWrapperFrame.Position = UDim2.new(0, GuiUtilities.StandardLineElementLeftMargin, 0, 6)
47+
textBoxWrapperFrame.AnchorPoint = Vector2.new(0, 0)
48+
textBoxWrapperFrame.AutomaticSize = Enum.AutomaticSize.Y
4749
textBoxWrapperFrame.Parent = frame
4850
GuiUtilities.syncGuiElementInputFieldColor(textBoxWrapperFrame)
4951
GuiUtilities.syncGuiElementBorderColor(textBoxWrapperFrame)
@@ -52,14 +54,17 @@ function LabeledTextInputClass.new(nameSuffix, labelText, defaultValue)
5254
textBox.Parent = textBoxWrapperFrame
5355
textBox.Name = "TextBox"
5456
textBox.ClearTextOnFocus = false
57+
textBox.MultiLine = true
5558
textBox.Text = defaultValue
5659
textBox.Font = Enum.Font.SourceSans
5760
textBox.TextSize = 15
61+
textBox.TextWrapped = true
5862
textBox.BackgroundTransparency = 1
5963
textBox.TextXAlignment = Enum.TextXAlignment.Left
64+
textBox.TextYAlignment = Enum.TextYAlignment.Center
6065
textBox.Size = UDim2.new(1, -kTextBoxInternalPadding, 1, GuiUtilities.kTextVerticalFudge)
6166
textBox.Position = UDim2.new(0, kTextBoxInternalPadding, 0, 0)
62-
textBox.AutomaticSize = Enum.AutomaticSize.X
67+
textBox.AutomaticSize = Enum.AutomaticSize.Y
6368
textBox.ClipsDescendants = true
6469

6570
GuiUtilities.syncGuiElementFontColor(textBox)

0 commit comments

Comments
 (0)