# Not receiving FXTopWindow events

**URL:** <https://www.ruby-forum.com/t/not-receiving-fxtopwindow-events/178814>\
**Category:** FXRuby\
**Created:** [November 11, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/not-receiving-fxtopwindow-events/178814 "2009-11-11T18:35:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [November 11, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/not-receiving-fxtopwindow-events/178814/1 "2009-11-11T18:35:50Z")

</div>

I am trying to listen for the FXTopWindow events SEL\_CLOSE,  
SEL\_MINIMIZE, SEL\_MAXIMIZE, SEL\_RESTORE because I want to execute some  
code when a person presses the X button to close the window, etc.

None of my code gets executed though. Can anyone help?

class TextDialog  
def initialize(parent)  
construct\_widget\_tree(parent)  
init if respond\_to? ‘init’  
end

def construct\_widget\_tree(parent)  
@topwin = FXMainWindow.new(parent, ‘title’)  
@topwin.width = 300  
@topwin.height = 200  
end

attr\_reader :topwin  
end

if **FILE** ==$0  
require ‘fox16’  
include Fox

app=FXApp.new  
w=TextDialog.new(app)

w.topwin.connect(SEL\_CLOSE) { app.exit }  
w.topwin.connect(SEL\_MINIMIZE) { puts “MIN” }  
w.topwin.connect(SEL\_MAXIMIZE) { puts “MAX” }  
w.topwin.connect(SEL\_RESTORE) { puts “RESTORE” }

w.topwin.show  
app.create  
app.run  
end

---

<div class="post-metadata">

**Author:** ![leslieviljoen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3d9bf3/32.png) [@leslieviljoen](https://www.ruby-forum.com/u/leslieviljoen)\
**Post date:** [November 11, 2009, 9:17pm UTC](https://www.ruby-forum.com/t/not-receiving-fxtopwindow-events/178814/2 "2009-11-11T21:17:26Z")

</div>

This forum looks dead so I am cross-posting to:  
[http://rubyforge.org/pipermail/fxruby-users/2009-November/date.html](http://rubyforge.org/pipermail/fxruby-users/2009-November/date.html)

I apologize for that.
