Slab icon indicating copy to clipboard operation
Slab copied to clipboard

Docking not working

Open megagrump opened this issue 3 years ago • 12 comments

I can't dock any window to any side of the screen in SlabTest. Dragging a window over one of the dock indicators does nothing. The indicator gets highlighted but nothing else happens.

Doing it programmatically like this:

if not docked then
    Slab.WindowToDock("bottom")
    docked = true
end

...makes the Window disappear, no matter if left, right or bottom.

megagrump avatar Dec 22 '21 13:12 megagrump

Hmm my commit for making dock work programmatically might have caused this issue. Will check soon

flamendless avatar Dec 22 '21 13:12 flamendless

Were you using WindowToDock with the SlabTest?

Dragging does not work for me now too. I wonder if this is due to the changes with the mouse api?

Have you checked this https://github.com/flamendless/Slab/wiki/Dock#windowtodock ? this works for me

flamendless avatar Dec 23 '21 00:12 flamendless

It's not caused by my changes. Every bug I report is double-checked against the released 0.9.0 code.

I tested WindowToDock in SlabTest. The window disappears.

	Slab.BeginWindow('SlabTest', SlabTest_Options)

	if not docked then
		Slab.WindowToDock('left')
		docked = true
	end

megagrump avatar Dec 23 '21 06:12 megagrump

I checked previous commits (before your changes) and yeah dragging wasn't working then. Weird that on a simple window it works but on SlabTest it does not 🤔 I'll have to do more digging

flamendless avatar Dec 23 '21 08:12 flamendless

@megagrump figured out the problem, you should be using Left/Right/Bottom (uppercase first character). I tested it on SlabTest and it works for me

image

Further testing shows the more of the following issues:

  • if a window's (programmatically docked) title bar is single-clicked, it behaves as if the window is held down thus following the mouse/dragging the window.
  • ~~Saving docked window to ini is problematic~~ Fixed
  • Can't still just drag the window and make it dock manually like before

flamendless avatar Dec 23 '21 10:12 flamendless

Maybe there should be an error when using WindowToDock with an unknown value? Window just disappearing is confusing. It also gets saved with ~~W and H being 0 in this case~~ the non-existent location, meaning it stays hidden forever, even after a restart.

SlabTest crashes on quit for me now if the window was not docked:

Error: /Internal/UI/Dock.lua:350: table index is nil

megagrump avatar Dec 23 '21 11:12 megagrump

  1. Dock window programmatically
  2. Undock it with mouse
  3. Window can not be moved anymore
  4. table index is nil crash on exit

megagrump avatar Dec 23 '21 12:12 megagrump

  1. Dock window programmatically
  2. Undock it with mouse
  3. Window can not be moved anymore
  4. table index is nil crash on exit

~~I tried reproducing it using these steps. I didnt encounter number 3 as I can still freely move the window around. I get the error at number 4.~~ Fixed.

flamendless avatar Dec 26 '21 02:12 flamendless

About this issue, I'll fix this as soon as your refactoring of the Window is done so there won't be conflicts if we work on the same file at the same time.

flamendless avatar Jan 04 '22 01:01 flamendless

Docking the main window to the right side of the screen does not look correct for me in SlabTest. Most of the window goes off the right side of the screen.

I still can't move the window after undocking.

Dock to the bottom, undock and quit the app. After restart: the window is in a weird position that makes it unusable. Only way to get out of this state is by deleting the saved ini file.

megagrump avatar Jan 12 '22 09:01 megagrump

Whats your whole test file?

flamendless avatar Jan 12 '22 11:01 flamendless

https://github.com/flamendless/Slab/blob/master/SlabTest.lua

megagrump avatar Jan 12 '22 13:01 megagrump