# Always on top

**URL:** <https://forum.juce.com/t/always-on-top/217>\
**Category:** General JUCE discussion\
**Created:** [April 20, 2005, 12:33am UTC](https://forum.juce.com/t/always-on-top/217 "2005-04-20T00:33:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![haydxn](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@haydxn](https://forum.juce.com/u/haydxn)\
**Post date:** [April 20, 2005, 12:33am UTC](https://forum.juce.com/t/always-on-top/217/1 "2005-04-20T00:33:30Z")

</div>

hiya 😃

is there a way to get a JUCE program to stay ‘always on top’ in windows?

---

<div class="post-metadata">

**Author:** ![DarrylN](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/darryln/32/10260_2.png) [@DarrylN](https://forum.juce.com/u/DarrylN)\
**Post date:** [April 20, 2005, 2:26am UTC](https://forum.juce.com/t/always-on-top/217/2 "2005-04-20T02:26:05Z")

</div>

I didn’t try it, but it looks like the following might work:

1. get a pointer to the NativeDesktopWindow for the Component that is your main window:  
pndw = mainWindow-\>getWindowFor (const Component \*const component);

2. call pndw-\>setAlwaysOnTop (1) ;

---

<div class="post-metadata">

**Author:** ![ost12666](https://avatars.discourse-cdn.com/v4/letter/o/9d8465/32.png) [@ost12666](https://forum.juce.com/u/ost12666)\
**Post date:** [April 20, 2005, 8:09am UTC](https://forum.juce.com/t/always-on-top/217/3 "2005-04-20T08:09:22Z")

</div>

“NativeDesktopWindow objects are created and managed internally by the Component class when it needs to put itself on the desktop, and applications should rarely need to use this class.”

whats wrong with void Component:: setAlwaysOnTop (const bool shouldStayOnTop) ?

There was a bug in previous JUCE version but I think it was fixed

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 20, 2005, 8:22am UTC](https://forum.juce.com/t/always-on-top/217/4 "2005-04-20T08:22:21Z")

</div>

Yes, use the Component::setAlwaysOnTop() method - only qualified experts should use NativeDesktopWindow.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [May 12, 2017, 9:57am UTC](https://forum.juce.com/t/always-on-top/217/5 "2017-05-12T09:57:13Z")

</div>


