Skip to content

Conversation

@ivaylo-matov
Copy link
Contributor

Purpose

Small PR following that can be logged under DYN-9829.

Added a custom resize grip in ScriptEditorWindow so the resize handle stays inside the visible window border. Previously, the window border overlapped the default resize grip.

image

Declarations

Check these if you believe they are true

Release Notes

Added a custom resize grip in ScriptEditorWindow so the resize handle stays inside the visible window border. Previously, the window border overlapped the default resize grip.

Reviewers

@zeusongit
@DynamoDS/eidos

FYIs

@dnenov
@achintyabhat

Copilot AI review requested due to automatic review settings November 26, 2025 14:36
@github-actions github-actions bot changed the title draft DYN-9829: draft Nov 26, 2025
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-9829

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a custom resize grip to the ScriptEditorWindow to improve visual alignment. The default resize grip was being overlapped by the window border, so this change implements a custom grip positioned inside the visible window area using Win32 API calls.

Key Changes:

  • Changed the window's ResizeMode from CanResizeWithGrip to CanResize to disable the default grip
  • Added a custom ResizeGrip control with manual positioning and event handling
  • Implemented Win32 interop to trigger window resizing when the custom grip is dragged

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
ScriptEditorWindow.xaml.cs Added Win32 interop constants, P/Invoke declaration, and mouse event handler to implement custom resize functionality
ScriptEditorWindow.xaml Replaced default resize mode with custom ResizeGrip control positioned inside window border

Comment on lines +55 to +57
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_SIZE = 0xF000;
private const int HTBOTTOMRIGHT = 0x0008;
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The constant names follow Win32 convention but are not sufficiently descriptive for C# code. Consider renaming to WindowsMessageSystemCommand, SystemCommandSize, and HitTestBottomRight respectively, or add XML documentation comments explaining what these magic values represent.

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are standard Win32 names. I've added comment above to clarify their use

Comment on lines 810 to 818
private void WindowResizeGrip_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (WindowState != WindowState.Normal)
return;

var helper = new WindowInteropHelper(this);
SendMessage(helper.Handle, WM_SYSCOMMAND, (IntPtr)(SC_SIZE + HTBOTTOMRIGHT), IntPtr.Zero);
e.Handled = true;
}
Copy link

Copilot AI Nov 26, 2025

Choose a reason for hiding this comment

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

The event handler lacks XML documentation. Add a summary comment explaining that this method triggers Win32-based window resizing when the custom resize grip is clicked, and why the custom implementation is necessary (to keep the grip inside the window border).

Copilot generated this review using guidance from repository custom instructions.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OTT but now addressed.

@ivaylo-matov ivaylo-matov changed the title DYN-9829: draft DYN-9829: Fix hidden resize grip in ScriptEditorWindow Nov 26, 2025
@ivaylo-matov ivaylo-matov reopened this Nov 26, 2025
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.

1 participant