Forum: wxRuby Making a frame stay on top sometimes

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Fe061a5e90b738e88623292d7d2084d2?d=identicon&s=25 Eric Rubin (erubin)
on 2008-11-20 15:39
(Received via mailing list)
I'm using STAY_ON_TOP in the style when I create my Frame app so it is
always on top, and it works fine.  What I want, though, is for the Frame
to
stay on top under some conditions, but behave normally under other
conditions.  I don't see any set_style method for Frame that would let
me
turn the STAY_ON_TOP behavior on and off dynamically.  Is there any way
to
do this?



Eric Rubin
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2008-11-20 15:50
(Received via mailing list)
Hi Eric

Eric Rubin wrote:
>
> I’m using STAY_ON_TOP in the style when I create my Frame app so it is
> always on top, and it works fine. What I want, though, is for the
> Frame to stay on top under some conditions, but behave normally under
> other conditions. I don’t see any set_style method for Frame that
> would let me turn the STAY_ON_TOP behavior on and off dynamically. Is
> there any way to do this?
>

 From my reading of wxWidgets discussions, there's no way to change the
style flags of a Window (inc Frame) after it's been created. This is
because changes are not guaranteed to be honoured on all platforms.

The way round this in your circumstance might be to have two frames,
with one hidden and one shown at any time. One has the STAY_ON_TOP
style, the other not. When you want to change the STAY_ON_TOP behaviour:

1) hide the currently shown frame
2) reparent that frame's top-level content (eg Panel) to the other frame
3) move the frame you're about to show to the same size and position
4) show the previously hidden frame

hth
alex
Fe061a5e90b738e88623292d7d2084d2?d=identicon&s=25 Eric Rubin (erubin)
on 2008-11-20 16:04
(Received via mailing list)
Thanks, but I just noticed that there is a Window#set_window_style_flag
which seems like it would do what I want.  I think I'll give that a try.
If
it doesn't work I might try your two frames solution.

Eric
Fe061a5e90b738e88623292d7d2084d2?d=identicon&s=25 Eric Rubin (erubin)
on 2008-11-20 16:15
(Received via mailing list)
Looks like Window#set_window_style_flag allows me to turn STAY_ON_TOP on
and
off (in MS Windows).

Eric
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2008-11-20 16:39
(Received via mailing list)
Eric Rubin wrote:
> Looks like Window#set_window_style_flag allows me to turn STAY_ON_TOP on and
> off (in MS Windows).
>

Ah, thanks, I thought there was some method that did this but couched in
warnings about changes to some flags on some platforms not being
honoured.

Useful to know that this one is - much neater solution.

alex
This topic is locked and can not be replied to.