# Trying to force widget to stay on screen

**URL:** <https://forums.unrealengine.com/t/trying-to-force-widget-to-stay-on-screen/1184721>\
**Category:** UI\
**Tags:** unreal-engine, question\
**Created:** [May 31, 2023, 4:25pm UTC](https://forums.unrealengine.com/t/trying-to-force-widget-to-stay-on-screen/1184721 "2023-05-31T16:25:36Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Everynone](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/everynone/32/1135017_2.png) [@Everynone](https://forums.unrealengine.com/u/Everynone)\
**Post date:** [May 31, 2023, 6:18pm UTC](https://forums.unrealengine.com/t/trying-to-force-widget-to-stay-on-screen/1184721/2 "2023-05-31T18:18:54Z")

</div>

> [@Krozjin](#):
>
> so if there’s much better ways of doing that I’m open to any suggestions.

The [Menu Anchor](https://docs.unrealengine.com/5.0/en-US/using-menu-anchors-in-umg-for-unreal-engine/) is the UE’s native way of handling context menus. And here’s how you can try it the hard way:

> [@UMG Widget: Stay on screen - But how?](https://forums.unrealengine.com/t/umg-widget-stay-on-screen-but-how/123044/5):
>
> while there’s half a dozen ways to implement this, the gist is to subtract half the widget size from the viewport size and use it as a clamp: vid: [https://i.gyazo.com/7e60baa21a0fbe5e5796d81524b27671.mp4](https://i.gyazo.com/7e60baa21a0fbe5e5796d81524b27671.mp4)

---

_[View the full topic](https://forums.unrealengine.com/t/trying-to-force-widget-to-stay-on-screen/1184721)._
