> For the complete documentation index, see [llms.txt](https://tanishisherewith.gitbook.io/archived-legacy-dynamichud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://tanishisherewith.gitbook.io/archived-legacy-dynamichud/moveable-screen/abstractmoveablescreen.md).

# AbstractMoveableScreen

This page talks about AbstractMoveableScreen.

## AbstractMoveableScreen

The [`AbstractMoveableScreen`](https://github.com/V-Fast/DynamicHUD/blob/master/src/main/java/com/tanishisherewith/dynamichud/huds/AbstractMoveableScreen.java) class extends the `Screen` class and provides additional functionality for creating moveable screens in Minecraft Fabric.

### Fields

* `dynamicutil`: The `DynamicUtil` instance used by this screen.
* `mc`: The `MinecraftClient` instance.
* `selectedWidget`: The currently selected widget.
* `dragStartX`, `dragStartY`: The starting position of a drag operation.
* `List<contextMenu>`: The List of context menu that are currently being displayed.
* `colorPicker`: The color picker that is currently displayed.
* `sliderWigdet`: The widget that is currently being edited by the slider.
* `List<Slider>`: The List of sliders.
* `mouseHandler`: The mouse handler for this screen.
* `dragHandler`: The drag handler for this screen.
* `gridSize`: The size of each grid cell in pixels.
* `ShouldPause`: Whether to pause if the screen is opened or not.
* `ShouldBeAffectedByResize`: Whether the stuff drawn on screen should be affected by screen resize or not.
* `WidgetX`: X position of the selected widget.
* `WidgetY`: Y position of the selected widget.

### Constructors

#### AbstractMoveableScreen(Text title, DynamicUtil dynamicutil)

Constructs an `AbstractMoveableScreen` object with the given title and dynamicutil instance.

### Methods

#### mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)

Handles mouse dragging on this screen. This method updates the position of the selected widget while dragging.

#### mouseReleased(double mouseX, double mouseY, int button)

Handles mouse release events on this screen. This method stops dragging or scaling the selected widget.

#### mouseClicked(double mouseX, double mouseY, int button)

Handles mouse clicks on this screen. This method starts dragging a widget if it was clicked.

#### render(MatrixStack matrices, int mouseX, int mouseY, float delta)

Renders this screen and its widgets on the screen.

#### setGridSize(int gridSize)

Sets the size of each grid cell in pixels.

#### setShouldPause(boolean shouldpause)

Sets whether to pause if the screen is opened or not.

#### setShouldBeAffectedByResize(boolean shouldBeAffectedByResize)

Sets whether the stuff drawn on screen should be affected by screen resize or not.

#### resize(MinecraftClient client, int width, int height)

Resizes this screen. If `ShouldBeAffectedByResize` is true, this method calls the superclass's implementation of this method.

#### shouldPause()

Returns whether to pause if the screen is opened or not.

#### handleRightClickOnWidget(Widget widget)

An abstract method that must be implemented by subclasses to handle right-clicks on widgets.

#### menu(Widget widget, int x, int y)

An abstract method that must be implemented by subclasses to display a context menu for a widget at the given position.
