Skip to content

Commit

Permalink
Fixed updating keybinds
Browse files Browse the repository at this point in the history
  • Loading branch information
xa1on committed Jan 20, 2024
1 parent af64bc5 commit 73807a4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
Binary file modified builds/rblxgui.rbxm
Binary file not shown.
2 changes: 1 addition & 1 deletion src/rblxgui/lib/Managers/KeybindManager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ local function InputEnded(p)
CompleteBind = false
end
elseif (not CompleteBind) or #CurrentKeys ~= 1 then
if m.FocusFunction.EditBind and not CompleteBind then m.FocusFunction.EditBind(util.CopyTable(CurrentKeys), true) end
if m.FocusFunction.EditBind and not CompleteBind then m.FocusFunction.EditBind(util.CopyTable(CurrentKeys), true)end
CompleteBind = true
table.remove(CurrentKeys, i - IndexShift)
if #CurrentKeys == 0 then CompleteBind = false end
Expand Down
1 change: 1 addition & 0 deletions src/rblxgui/lib/Objects/ColorInput.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ end
function ColorInput.new(Arguments, Parent)
local self = GUIObject.new(Arguments, Parent)
setmetatable(self,ColorInput)
self.IgnoreText = true
self.Disabled = self.Arguments.Disabled
self.ColorInputContainer = Instance.new("Frame", self.Parent)
self.ColorInputContainer.BackgroundTransparency = 1
Expand Down
11 changes: 7 additions & 4 deletions src/rblxgui/lib/Objects/InputField.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function InputField.GetItemInfo(Item)
return ItemInfo
end

function InputField:AddItem(Item)
function InputField:AddItem(Item, Action)
local ItemInfo = self.GetItemInfo(Item)
local ItemButton = Instance.new("TextButton", self.DropdownScroll.Content)
ItemButton.Name = ItemInfo.Name
Expand Down Expand Up @@ -136,6 +136,9 @@ function InputField:AddItem(Item)
self.SelectedItem = true
self.Value = ItemInfo.Value
self.Input.Text = ItemInfo.Name
if Action then
Action()
end
end)
ItemButton.MouseEnter:Connect(function()
task.wait(0)
Expand All @@ -148,8 +151,8 @@ function InputField:AddItem(Item)
end)
end

function InputField:AddItems(Items)
for _, v in pairs(Items) do self:AddItem(v) end
function InputField:AddItems(Items, Action)
for _, v in pairs(Items) do self:AddItem(v, Action) end
end

function InputField:ClearItems()
Expand Down Expand Up @@ -238,7 +241,7 @@ function InputField.new(Arguments, Parent)
self.Input.Name = "Input"
self.Input.Changed:Connect(function(p)
if p == "Text" then
if not self.SelectedItem then
if not self.SelectedItem and not self.IgnoreText then
self.Value = self.Input.Text
end
self.SelectedItem = false
Expand Down
1 change: 1 addition & 0 deletions src/rblxgui/lib/Objects/InstanceInputField.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function InstanceInputField.new(Arguments, Parent)
Arguments.DisableEditing = true
local self = InputField.new(Arguments, Parent)
setmetatable(self,InstanceInputField)
self.IgnoreText = true
self.DefaultEmpty = {}
self.Focusable = true
self.TextEditable = true
Expand Down
9 changes: 2 additions & 7 deletions src/rblxgui/lib/Objects/KeybindInputField.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ end
function KeybindInputField:AddBind(Bind)
local BindInfo = self.GetItemInfo(Bind)
if #BindInfo.Value[1]>0 and #BindInfo.Value[#BindInfo.Value]>0 then BindInfo.Value[#BindInfo.Value+1] = {} end
self:AddItem({Name = BindInfo.Name or KeybindManager.GenerateKeybindList(BindInfo.Value), Value = BindInfo.Value})
self:AddItem({Name = BindInfo.Name or KeybindManager.GenerateKeybindList(BindInfo.Value), Value = BindInfo.Value}, function() self:UpdateBind(BindInfo.Value) end)
end

function KeybindInputField:AddBinds(Binds)
Expand Down Expand Up @@ -96,6 +96,7 @@ function KeybindInputField.new(Arguments, Parent)
Arguments.DisableEditing = true
local self = InputField.new(Arguments, Parent)
setmetatable(self,KeybindInputField)
self.IgnoreText = true
self.Holdable = self.Arguments.Holdable
self.Unrestricted = self.Arguments.Unrestricted
if not self.Holdable then self.Holdable = false end
Expand All @@ -116,12 +117,6 @@ function KeybindInputField.new(Arguments, Parent)
end)
if self.Arguments.Binds then self:AddBinds(self.Arguments.Binds) end
self:SetBind(self.Arguments.Bind or self.Arguments.CurrentBind)
self.Input.Changed:Connect(function(p)
if p == "Text" then
task.wait(0)
--self:UpdateBind(self.Value)
end
end)
return self
end

Expand Down

0 comments on commit 73807a4

Please sign in to comment.