Problem
I’m making a tabbed window where if you click on a button, different things show up in the frame below the buttons. Basically, the active frame visibility is enabled while all other frames have their visibility set to false. That part is working. However, the issue is that for whatever reason, the highlight on the previously active frame is not turned off.
In this particular case, the Queue was the first one to be active as the code manually sets it to be active. However, when I click on the Server tab, it highlights like it’s supposed to, but the highlight of the Queue tab is not removed even though the disable function runs and it does set the highlight transparency to 1. When I check the GUI properties, the transparency is still 0. Not sure what’s going on with this. I think it has something to do with the hover code.
-- Disables all tabs from view.
local function disableAllTabs()
for _, item in ipairs(tabList) do
item.frame.Visible = false
item.button.UIStroke.Transparency = 1
print("Disable", item.index)
end
end
This function, when executed, does print the index of all four tabs in the table, so I know that it is executing, but item.button.UIStroke.Transparency = 1
seems to have no effect for some reason.
object.MouseEnter:Connect(function()
object.BackgroundColor3 = Color3.fromRGB(64, 64, 64)
object.UIStroke.Color = Color3.fromRGB(255, 255, 255)
object.UIStroke.Transparency = 0
end)
object.MouseLeave:Connect(function()
object.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
object.UIStroke.Color = Color3.fromRGB(0, 170, 255)
--object.UIStroke.Transparency = 1
local index = object:GetAttribute("Index")
if index ~= activeIndex then
object.UIStroke.Transparency = 1
end
print("Leave", object.Name, index, activeIndex)
end)
This is the code to highlight the button. I’m using UIStroke to do the highlight. This code is part of a larger function that initializes the tab buttons by reading the tags on the buttons. The activeIndex
variable is the index of the currently active tab. What’s interesting is that if I mouse over the Queue button after the Server button is active, the highlight of the Queue button is disabled.
This is the printout from the various print statements that proves that the code in question is executing. At this point, I’m at a loss to explain why this is happening. This isn’t multithreaded so it shouldn’t be having any race conditions. Any ideas?
Thanks.