Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to programmatically set a window to a dock position? Also make docked window unremovable there #92

Closed
flamendless opened this issue Aug 5, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@flamendless
Copy link
Owner

No description provided.

@halsten-dev
Copy link

Same question here. I need this too.

@flamendless flamendless added the enhancement New feature or request label Aug 21, 2021
@flamendless
Copy link
Owner Author

@chicogamedev just implemented this in commit c77087d

sample usage would be:

	Slab.BeginWindow("test", {Title = "test"})
		Slab.WindowToDoc("Left")
	Slab.EndWindow()

For now users are to handle when they want to remove the window to the dock by using boolean flag to control whether to call Slab.WindowToDoc. As you can see that this can also be used to permanently set a window to a dock.

Let me know if there's an issue with this. I may have missed out on some.

@flamendless flamendless changed the title How to programatically set a window to a dock position? Also make docked window unremovable there How to programmatically set a window to a dock position? Also make docked window unremovable there Aug 25, 2021
@halsten-dev
Copy link

Awesome !

I'll try it out. But is there a way to preset the size (Width) of the docked window ?

Or will it adapt on the W of the window?

Thanks

@flamendless
Copy link
Owner Author

flamendless commented Aug 27, 2021

@chicogamedev this is fixed now. Sample usage would be:

local flag = false
local flag2 = false
local flag3 = false

function love.update(dt)
	Slab.Update(dt)
	-- SlabTest.Begin()
	Slab.BeginWindow("test", {
		Title = "test",
		W = 320,
	})
		if not flag then
			Slab.WindowToDock("Left")
			flag = true
		end
	Slab.EndWindow()

	Slab.BeginWindow("test2", {
		Title = "test2",
		W = 160,
	})
		if not flag2 then
			Slab.WindowToDock("Right")
			flag2 = true
		end
	Slab.EndWindow()

	Slab.BeginWindow("test3", {
		Title = "test3",
		H = 120
	})
		if not flag3 then
			Slab.WindowToDock("Bottom")
			flag3 = true
		end
	Slab.EndWindow()
end

Right now W can only be used for Left and Right docks while H for Bottom

( i have to think more how to make it so that the flags are stored internally in Slab's side)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants