Focusing on a TextBox ends Shift input

Hey, forum. I’m currently making a UI library and I’m in the last bits of development. I’m trying to make it so when a user presses Tab on their keyboard with one of the TextBox’s focused, it will focus the next TextBox. The issue is that I’m also trying to make it so if either Shift key is pressed, it will focus the previous TextBox, but the Shift input ends when I do that, so it only works for one TextBox and doesn’t stack properly.

Are there any workarounds or fixes? If so, let me know.

Thanks.

Go to Lite Script or something, to Line 4189 and Line 4195 and delete the two prints.

The prints are what’s telling me what’s going on, but they don’t inherently affect the outcome of events.

Mind sending the code that deals with this stuff so I can see if I know what your doing incorrect?

Ah i didnt saw that


Sure.

self.SpecialKey: string = “Shift”
self.DoSpecial: boolean = false

if (typeof(self.SpecialKey) == "string") then -- SpecialKey
	for i, v in next, Enum.KeyCode:GetEnumItems() do
		if (v.Name:sub(math.max(0, #v.Name - #self.SpecialKey) + 1):lower() == self.SpecialKey:lower()) then
			table.insert(self.Connections, UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
				if (input.KeyCode == v) then
					self.DoSpecial = true
				end
			end))
			table.insert(self.Connections, UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
				if (input.KeyCode == v) then
					self.DoSpecial = false
				end
			end))
		end
	end
end

That’s to tell the types if an action should be special or not, in this case, go backwards or go forwards when tabbing between TextBox’s.

table.insert(self.Connections, HueValue:GetPropertyChangedSignal("Text"):Connect(function(): ()
	if (HueValue.Text:find("\t")) then
		HueValue.Text = HueValue.Text:gsub("\t", "")
		if (_self.DoSpecial) then
			HueValue:ReleaseFocus()
		else
			HueValue:ReleaseFocus(); SaturationValue:CaptureFocus()
		end
	else
		if (not Rainbow) then
			local Value = tonumber(HueValue.Text)
			if (Value) then
				HSV(math.clamp(math.floor(Value), 0, 360)/360)
			end
		end
	end
end))

And this is one of the code chunks for one of the TextBox’s, but the tabbing code is the same between all TextBox’s.

Shift is the global key used for this specific type of action, that’s why I’m trying to use it in particular.

I’ll try it when I get to developing on this again. I’ll reach back to you if it works.

Thanks.