-
What do you want to achieve? Keep it simple and clear!
The GUI to be visible when created -
What is the issue? Include screenshots / videos if possible!
I create a plugin widget usingDockWidgetPluginGuiInfo.new()
andCreateDockWidgetPluginGui()
, it creates but it is not visible.
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have used code from the devhub that I used the first time I messed around with widgets and it worked, now it doesnt work at all, yes I updated the plugin, at first I realized its cause I set created to true in the creation function which doesnt work cause after it checks if its false, if it is then it runs the function, that is now fixed, however it still does not get set to visible.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
I have not yet to try printing before and after the function gets called, but it surely is considering it prints, im assuming that its being created and not being made visible, however I could be wrong, but it prints before and after it gets created like it is supposed to, so the function is running.
Code
local toolbar = plugin:CreateToolbar(pluginSettings.pluginName)
local toolbarButton = toolbar:CreateButton(pluginSettings.pluginName, pluginSettings.pluginDescription, pluginSettings.pluginImage)
local widgetCreated = false
local widgetOpened = false
-- Functions
local function createWidget()
if widgetCreated == false then
-- Create widget
print("creating")
local widgetInfo = DockWidgetPluginGuiInfo.new(
Enum.InitialDockState.Float, -- Widget will be initialized in floating panel
true, -- Widget will be initially enabled
false, -- Don't override the previous enabled state
200, -- Default width of the floating window
300, -- Default height of the floating window
150, -- Minimum width of the floating window
150 -- Minimum height of the floating window
)
local gribraryWidget = plugin:CreateDockWidgetPluginGui("TestWidget", widgetInfo)
gribraryWidget.Title = "Gribrary" -- Optional widget
print("created")
end
end
local function openWidget()
end
local function closeWidget()
end
toolbarButton.Click:Connect(function(var)
if widgetCreated == false then
-- If widget isnt created, then create widget
createWidget()
widgetCreated = true
elseif widgetCreated == true then
if widgetOpened == false then
-- Open cause its not open
elseif widgetOpened == true then
-- Close close cause its open
end
end
end)