# Tkmessage box

**URL:** <https://www.ruby-forum.com/t/tkmessage-box/108688>\
**Category:** Ruby\
**Created:** [July 6, 2007, 1:05am UTC](https://www.ruby-forum.com/t/tkmessage-box/108688 "2007-07-06T01:05:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@jason](https://www.ruby-forum.com/u/jason)\
**Post date:** [July 6, 2007, 1:05am UTC](https://www.ruby-forum.com/t/tkmessage-box/108688/1 "2007-07-06T01:05:06Z")

</div>

I have a TkRoot which opens a tktoplevel window:

@toplevel.focus(true)  
@toplevel.set\_grab  
@toplevel.wait\_destroy # same as top.tkwait\_destroy  
@toplevel.release\_grab

On my top level window I have a button which when clicked opens a  
TkMessageBox. When the message box opens the TkRoot window comes back  
into focus above the TopLevel window. How can I stop this from  
happening? I want the TkMessageBox to be on top of the TopLevel window  
which is on top of the TkRoot.

---

<div class="post-metadata">

**Author:** ![jason](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/dc4da7/32.png) [@jason](https://www.ruby-forum.com/u/jason)\
**Post date:** [July 6, 2007, 2:02am UTC](https://www.ruby-forum.com/t/tkmessage-box/108688/2 "2007-07-06T02:02:45Z")

</div>

On Jul 5, 2007, at 7:05 PM, Jason wrote:

> happening? I want the TkMessageBox to be on top of the TopLevel window  
> which is on top of the TkRoot.

I don’t think you’re posting enough information. You’re forcing  
anyone motivated to help you to do a whole lot of guessing. I  
recommend that you post all your code. If you feel you can’t do that,  
at least post the sections containing the code that instantiates the  
TkMessaageBox and the button callback code that pops it up. You need  
to do more to help those who want to help you.

Having said that, I’ll make a wild guess. Perhaps you didn’t  
construct the TkMessageBox by following the example Nagai san  
provided recently for making modal child windows. I would think the  
same rules apply to the TkMessageBox as to your Toplevel.

Regards, Morton
