KeybindField
A KeybindField
is a rectangular area in which people can enter and store Enum.KeyCode
InputObject
's, then trigger a callback after pressing the stored KeyCode
Summary
Properties
Property | Type | Description |
---|---|---|
Placeholder |
string? |
The text placeholder to instruct users on how to interact with the component. |
Value |
Enum.Keycode? |
The default shortcut the KeybindField is bound to. |
View all inherited from BaseComponent
Methods
Events
Event | Signature | Description |
---|---|---|
BindPressed |
((self: KeybindField, value: Enum.KeyCode, inputComplete: boolean, gameProcessedEvent: boolean) -> unknown)? |
A Callback function that is triggered when the Value KeyCode has been pressed. |
ValueChanged |
((self: KeybindField, value: Enum.KeyCode) -> unknown)? |
A Callback function that is triggered when the Value property has been modified. |
Types
type KeybindFieldProperties = Frame & {
Placeholder: string?,
Value: Enum.KeyCode?,
BindPressed: ((
self: KeybindField,
value: Enum.KeyCode,
inputComplete: boolean,
gameProcessedEvent: boolean
) -> unknown)?,
ValueChanged: ((self: KeybindField, value: Enum.KeyCode) -> unknown)?,
}
type KeybindField = BaseComponent & Components & KeybindFieldProperties
Function Signature
Example
local keybindField = row:Right():KeybindField({
ValueChanged = function(self, value: Enum.KeyCode)
print("Value changed:", value)
end,
BindPressed = function(
self,
value: Enum.KeyCode,
inputComplete: boolean,
gameProcessedEvent: boolean
)
if not inputComplete or gameProcessedEvent then
return
end
print("Pressed bind:", value)
end,
})
print(keybindField:IsA("Frame")) --> true
print(keybindField.ClassName) --> "Frame"
print(keybindField.Type) --> "KeybindField"
keybindField.Value = Enum.KeyCode.Z --> Value changed: Enum.KeyCode.Z