Class
PluginGui
NotCreatableNotReplicated
An abstract base class for GUIs that display GuiObjects in
Roblox Studio widgets.
PluginGui is an abstract class for GUIs that allow the display of
GuiObjects in various Roblox Studio widgets. As of right
now, the only available PluginGui type is DockWidgetPluginGui, but
there may be more in the future!
Properties 1#
Methods 2#
| BindToClose | Binds a function that runs when the user closes the PluginGui. |
| GetRelativeMousePosition | Returns the position of the mouse relative to the PluginGui.PluginSecurity security |
BindToClose(function: Function = nil): ()#
This method binds a function that runs when the user clicks the close
button of the PluginGui. The widget closes and its
Enabled property becomes false even when
a function is bound, so the function can't prevent or delay closing. Use
it to perform tasks such as saving work when the widget closes.
For example, the following code saves work when the user closes the widget:
local function saveWork()
-- Save the user's work here.
end
pluginGui:BindToClose(function()
saveWork()
end)Call BindToClose() without an argument to unbind the current function:
pluginGui:BindToClose()See also:
Plugin:CreateDockWidgetPluginGuiAsync()to create aPluginGuiDataModel:BindToClose(), which can be used to bind a function to the game ending and should not be confused with this function
| Name | Type | Default | Description |
|---|---|---|---|
function | Function | nil | The function to bind the close button to. If no function is specified then any previously specified function will be unbound. |
Returns
()
GetRelativeMousePosition(): Vector2#
PluginSecurity security
GetRelativeMousePosition returns the position of the mouse relative to the
top-left corner of the PluginGui. The returned value changes only
if a mouse input began on the PluginGui, or if the mouse is presently
hovering over the window.
Returns
Vector2— The screen position of the mouse relative to the PluginGui in pixels.
Events 6#
| PluginDragDropped | Fires when the user releases their mouse when hovering over a PluginGui
during a drag operation started by Plugin:StartDrag().PluginSecurity security |
| PluginDragEntered | Fires when the user's mouse enters a PluginGui during a drag operation
started by Plugin:StartDrag().PluginSecurity security |
| PluginDragLeft | Fires when the user's mouse leaves a PluginGui during a drag operation
started by Plugin:StartDrag().PluginSecurity security |
| PluginDragMoved | Fires when the user's mouse moves within a PluginGui during a drag
operation started by Plugin:StartDrag().PluginSecurity security |
| WindowFocused | Fires when the user begins interacting with the window of the PluginGui.PluginSecurity security |
| WindowFocusReleased | Fires when the user stops interacting with the window of the PluginGui.PluginSecurity security |
PluginDragDropped(dragData: Dictionary)#
PluginSecurity security
PluginDragDropped fires when the user releases their mouse over a
PluginGui during a drag operation started by
Plugin:StartDrag().
See also:
| Name | Type | Default | Description |
|---|---|---|---|
dragData | Dictionary | A copy of the data originally passed to Plugin:StartDrag(). |
PluginDragEntered(dragData: Dictionary)#
PluginSecurity security
PluginDragEntered fires when the user's mouse enters the
PluginGui during a drag operation started by
Plugin:StartDrag().
This event is useful for displaying a "Drop Here" UI on PluginGuis where a
drag operation can be dropped. Such a UI should be hidden when either
PluginDragLeft or
PluginDragDropped fire.
See also:
| Name | Type | Default | Description |
|---|---|---|---|
dragData | Dictionary | A copy of the data originally passed to Plugin:StartDrag(). |
PluginDragLeft(dragData: Dictionary)#
PluginSecurity security
PluginDragLeft fires when the user's mouse leaves a PluginGui
during a drag operation started by Plugin:StartDrag().
This event and PluginDragDropped are
useful for hiding a "Drop Here" UI on PluginGuis where a drag operation
can be dropped. Such a UI should be shown when either
PluginDragEntered fires.
See also:
| Name | Type | Default | Description |
|---|---|---|---|
dragData | Dictionary | A copy of the data originally passed to Plugin:StartDrag(). |
PluginDragMoved(dragData: Dictionary)#
PluginSecurity security
PluginDragMoved fires when the user's mouse moves within a
PluginGui during a drag operation started by
Plugin:StartDrag().
See also:
| Name | Type | Default | Description |
|---|---|---|---|
dragData | Dictionary | A copy of the data originally passed to Plugin:StartDrag(). |
WindowFocused()#
PluginSecurity security
WindowFocused fires immediately when the user starts interacting with
the PluginGui's window, usually by clicking on it. This functions works
similarly to the similarly-named UserInputService.WindowFocused
event. It fires before any GuiObject.InputBegan events related to
mouse buttons.
If another PluginGui is in focus and the user focuses this
PluginGui, then this event fires after the other's
WindowFocusReleased event. However,
if the main game window was in focus, this event fires after
UserInputService.WindowFocusReleased.
WindowFocusReleased()#
PluginSecurity security
WindowFocusReleased fires immediately when the user stops interacting
with the PluginGui's window, usually by clicking on something not in the
window. This functions works similarly to the similarly-named
UserInputService.WindowFocusReleased event.
If focus is moving to another PluginGui while the user had this
PluginGui in focus, then this event fires before the other's
WindowFocused event. However, if the main
game window is being put in focus, this event fires after
UserInputService.WindowFocused.
Inherited members#
Inherited from GuiBase2d 12
Properties (11)
AbsolutePosition, AbsoluteRotation, AbsoluteSize, AutoLocalize, Localize, RootLocalizationTable, SelectionBehaviorDown, SelectionBehaviorLeft, SelectionBehaviorRight, SelectionBehaviorUp, SelectionGroup
Events (1)
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild