# Question about Window#raise

**URL:** <https://www.ruby-forum.com/t/question-about-window-raise/144730>\
**Category:** wxRuby\
**Created:** [August 1, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/question-about-window-raise/144730 "2008-08-01T15:54:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erubin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/82dd89/32.png) [@erubin](https://www.ruby-forum.com/u/erubin)\
**Post date:** [August 1, 2008, 3:54pm UTC](https://www.ruby-forum.com/t/question-about-window-raise/144730/1 "2008-08-01T15:54:54Z")

</div>

I want to force my Frame to be visible under certain conditions, even if  
it’s currently behind other windows. I am running under Windows XP. I  
am  
calling raise to do this, but the Frame doesn’t come to the front,  
though  
the icon does alert. Isn’t this what Window#raise is supposed to do?  
Is  
this a Windows issue?

Eric R.

---

<div class="post-metadata">

**Author:** ![erubin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/82dd89/32.png) [@erubin](https://www.ruby-forum.com/u/erubin)\
**Post date:** [August 1, 2008, 4:23pm UTC](https://www.ruby-forum.com/t/question-about-window-raise/144730/2 "2008-08-01T16:23:36Z")

</div>

Hi Eric

Eric R. wrote:

> I want to force my Frame to be visible under certain conditions, even  
> if it’s currently behind other windows. I am running under Windows XP.  
> I am calling raise to do this, but the Frame doesn’t come to the  
> front, though the icon does alert. Isn’t this what Window#raise is  
> supposed to do? Is this a Windows issue?

Window#raise when applied to a managed (top-level) window should bring  
it to the front - but only among the Frames of this application, not of  
all the running desktop applications. It sounds like you actually want  
to bring the whole application to the front, and I’m not aware of any  
way of doing this in wxWidgets.

You might find Wx::TopLevelWindow#request\_user\_attention relevant:  
[http://wxruby.rubyforge.org/doc/toplevelwindow.html#TopLevelWindow\_requestuserattention](http://wxruby.rubyforge.org/doc/toplevelwindow.html#TopLevelWindow_requestuserattention)  
(although the docs talk only about GTK and Windows, this also works on  
OS X)

You might also look at this discussion on wxWidgets:  
[http://www.nabble.com/wxMac---Bring-application-to-front-td3851603.html](http://www.nabble.com/wxMac---Bring-application-to-front-td3851603.html)

In one of the follow-ups it mentions a Windows-specific API call to  
bring an application to the front. If this is really necessary, you may  
find it possible to make this call via Ruby’s Win32API. You can get the  
Windows-native id of a Frame using Wx::Window#get\_handle

hth  
alex
