[wxruby-users] Question about Window#raise

Alex Fenton alex at pressure.to
Fri Aug 1 10:21:44 EDT 2008


Hi Eric

Eric Rubin 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
(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

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


More information about the wxruby-users mailing list