# Popup Window

**URL:** <https://www.ruby-forum.com/t/popup-window/122648>\
**Category:** wxRuby\
**Created:** [December 10, 2007, 11:20am UTC](https://www.ruby-forum.com/t/popup-window/122648 "2007-12-10T11:20:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [December 10, 2007, 11:20am UTC](https://www.ruby-forum.com/t/popup-window/122648/1 "2007-12-10T11:20:34Z")

</div>

Hey!  
I would need a popup window like this (not necessarily associated to a  
taskbaricon):

> **[DuckDuckGo — Privacy, simplified.](https://duckduckgo.com/)**
>
> The Internet privacy company that empowers you to seamlessly take control of your personal information online, without any tradeoffs.

I should be possible to show such a window for a certain time,  
displaying a certain message.

Is a similar thing possible with wx? Are there oder options?

thx ck

---

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [December 10, 2007, 11:52am UTC](https://www.ruby-forum.com/t/popup-window/122648/2 "2007-12-10T11:52:55Z")

</div>

Hey Ck,

On 12/10/07, Christian K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hey!  
> I would need a popup window like this (not necessarily associated to a  
> taskbaricon):
> 
> [DuckDuckGo — Privacy, simplified.](http://www.venraiker.com/wp-content/uploads/2006/03/libnotifyvx.png)

Graphically wise, no, that’s something that you would have to  
specifically  
setup to be drawn. But, window popup wise, yes, you can setup a  
Wx::MiniFrame to create the said popup window. And by utilizing Wx::  
SystemSettings.get\_metric(Wx::SYS\_SCREEN\_X) and Wx::  
SystemSettings.get\_metric(Wx::SYS\_SCREEN\_Y) you should be able to  
determine  
the size of the screen to position your “popup notification” to show,  
and  
hide.

A quick and dirty example would be:

class MyPopupWin \< Wx::MiniFrame  
def initialize(parent,timeout)  
super(parent)  
@timer = Timer.new(self,10001)  
evt\_timer(10001) do { @timer.stop; self.show(false); }  
self.show(true)  
@timer.start(timeout)  
end  
end

Note, this is not tested code, just quick spur of the moment type  
design,  
but general idea should be there for you to use.

L8ers,

Mario S.

I should be possible to show such a window for a certain time,

---

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [December 10, 2007, 5:26pm UTC](https://www.ruby-forum.com/t/popup-window/122648/3 "2007-12-10T17:26:31Z")

</div>

Mario S. wrote:

> class MyPopupWin \< Wx::MiniFrame  
> def initialize(parent,timeout)  
> super(parent)  
> @timer = Timer.new(self,10001)  
> evt\_timer(10001) do { @timer.stop; self.show(false); }  
> self.show(true)  
> @timer.start(timeout)  
> end  
> end

Does a Wx::MiniFrame need a parent window? I doesn’t have a parent  
window, just a taskbaricon. When i pass nil to the constructor it  
generates an error.

greets ck

---

<div class="post-metadata">

**Author:** ![sealedsun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sealedsun](https://www.ruby-forum.com/u/sealedsun)\
**Post date:** [December 10, 2007, 7:51pm UTC](https://www.ruby-forum.com/t/popup-window/122648/4 "2007-12-10T19:51:08Z")

</div>

Wx::MiniFrame does need a Parent Window in order to be created, but not  
shown. You can create a Simple Window, for the Parent, but that window  
should not need to be shown in order for the Wx::MiniFrame to be shown.

L8ers,

Mario S.
