# Closing DialogBox in FXRuby

**URL:** <https://www.ruby-forum.com/t/closing-dialogbox-in-fxruby/147832>\
**Category:** Ruby\
**Created:** [September 5, 2008, 8:30pm UTC](https://www.ruby-forum.com/t/closing-dialogbox-in-fxruby/147832 "2008-09-05T20:30:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mawiniarski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mawiniarski](https://www.ruby-forum.com/u/mawiniarski)\
**Post date:** [September 5, 2008, 8:30pm UTC](https://www.ruby-forum.com/t/closing-dialogbox-in-fxruby/147832/1 "2008-09-05T20:30:58Z")

</div>

Greetings,

I’ve got opened MainWindow and DialogBox in which I want to manipulate  
some data, using entry form and methods.

How to close DialogBox to return to MainWindow not using standard “OK”  
“Cancel” buttons ?

The code is:

@bChangeProfile = FXButton.new(@vFrame2, “Change”, nil, nil, 0,  
:opts =\> LAYOUT\_CENTER\_X | LAYOUT\_BOTTOM |  
LAYOUT\_FILL\_X | LAYOUT\_FIX\_HEIGHT | BUTTON\_NORMAL,  
:height =\> 25).connect(SEL\_COMMAND) do |sender, selector, data|

```
 # checkPassword(

```

getSelectedLogin)  
# if checkPrassword returns true DialogBox should close and  
return to MainWindow  
# if returns false should stay in DialogBox

end

Thanks.

---

<div class="post-metadata">

**Author:** ![mawiniarski](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/fbc32d/32.png) [@mawiniarski](https://www.ruby-forum.com/u/mawiniarski)\
**Post date:** [September 6, 2008, 12:08am UTC](https://www.ruby-forum.com/t/closing-dialogbox-in-fxruby/147832/2 "2008-09-06T00:08:43Z")

</div>

On Fri, Sep 5, 2008 at 1:24 PM, MAwiniarski [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> I’ve got opened MainWindow and DialogBox in which I want to manipulate  
> some data, using entry form and methods.
> 
> How to close DialogBox to return to MainWindow not using standard “OK”  
> “Cancel” buttons ?

Something like this should work:

```
getApp().stopModal(dialogBox, true)
dialogBox.hide

```

Hope this helps,

Lyle
