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

Introduce dockable context menu to toolwindows #5203

Merged
merged 4 commits into from
Oct 24, 2019

Conversation

bclothier
Copy link
Contributor

Closes #3214

image

We also now can know the toolwindow's state (whether it's docked, floating or undockable). The context menu is injected via message pump, so it is only available over unused area of the toolwindow. Right-clicking on a used area will yield the usual context menu:

image

@@ -429,14 +430,77 @@ private void AdjustSize()
}
}

private static void ToggleDockable(IntPtr hWndVBE)
{
NativeMethods.SendMessage(hWndVBE, 0x1044, (IntPtr)0xB5, IntPtr.Zero);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: do these hex numbers have particular meaning? would constants be useful here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was more or less a copy-pasta from the original VBA solution from the linked issue, which is also documented (sort of) in the wiki:

https://github.com/rubberduck-vba/Rubberduck/wiki/VBE-Window-Messages

In particular, the 0x1044 is WM_USER + 3140 and the 0xB5 seems to be a subcode for the WM_USER + 3140 message.

My original thought was that this would be a one-trick pony and wouldn't be used anywhere, so it didn't need constants. However, if we want to wrap it in VbIdeMessage static class, I can get one started with it just and we can add other when we actually need them.


if (_menuHandle == IntPtr.Zero)
{
Debug.Print("Cannot create menu handle");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it appropriate to log this (or similar occurrances below)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a logger.

@retailcoder retailcoder merged commit fc6cae1 into rubberduck-vba:next Oct 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No Way to Dock Tool Windows after Uncheck Dockable (even after Restart)
3 participants