DockWidgetPluginGui Default Size Issue

Issue
When using plugin:CreateDockWidgetPluginGui(), the default size parameter does not work.

Desired Behavior
A 250x250px window appears on the screen.

Actual Behavior

Code

local function createDock(name,defaultSize,minSize)
		print(defaultSize) --default size that is given to dock info object (prints 250,250)
		local info = DockWidgetPluginGuiInfo.new(
			Enum.InitialDockState.Float,
			true,
			true,
			defaultSize.X,
			defaultSize.Y,
			minSize.X,
			minSize.Y
		)
		
		local dock = plugin:CreateDockWidgetPluginGui(name,info)
		dock.Name = "EasyLS Subdock - "..name
		dock.Title = name
		
		return dock
	end

Above is the function relevant to the issue
Entire script can be found here

All ideas are welcome, any help is appreciated!

3 Likes

The defaultSize parameter in the DockWidgetPluginGuiInfo.new() constructor does not control the initial size of the dock widget. Instead, it specifies the default size that is given to the dock widget info object. To set the initial size of the dock widget, you need to use the initialSize property of the DockWidgetPluginGuiInfo object.

local function createDock(name, defaultSize, minSize)
    print(defaultSize) -- default size that is given to dock info object (prints 250,250)
    local info = DockWidgetPluginGuiInfo.new(
        Enum.InitialDockState.Float,
        true,
        true,
        minSize.X,
        minSize.Y,
        minSize.X,
        minSize.Y
    )
    
    info.initialSize = Vector2.new(defaultSize.X, defaultSize.Y)
    
    local dock = plugin:CreateDockWidgetPluginGui(name, info)
    dock.Name = "EasyLS Subdock - " .. name
    dock.Title = name
    
    return dock
end

initialSize is a read-only property

Also, Plugin | Documentation - Roblox Creator Hub, the notes in the code sample they give there implies that default size does reflect the intial floating window size.

Apologies for the confusion. You are correct, the initialSize property of the DockWidgetPluginGuiInfo object is read-only and cannot be directly modified.

To achieve the desired behavior of a 250x250 pixel window, you can set the defaultSize parameter as you originally had it and manually resize the dock widget after creating it using the SetSize() method.

local function createDock(name, defaultSize, minSize)
    print(defaultSize) -- default size that is given to dock info object (prints 250,250)
    local info = DockWidgetPluginGuiInfo.new(
        Enum.InitialDockState.Float,
        true,
        true,
        minSize.X,
        minSize.Y,
        minSize.X,
        minSize.Y
    )
    
    local dock = plugin:CreateDockWidgetPluginGui(name, info)
    dock.Name = "EasyLS Subdock - " .. name
    dock.Title = name
    
    dock:SetSize(defaultSize)
    
    return dock
end

SetSize is not a method of a DockWidgetPluginGui

been an issue for a while now (since November-December) and no one seems to have posted a bug report about it.
I can confirm that this is NOT intended behavior but I assume it’ll be fixed sooner or later

1 Like