in reply to Tk overrideredirect topwindow on top

Your program will have to detect when the dialog becomes obscured and re-raise it. Marking the dialog as a transient window is a request that the WM keep it above its "parent" but you are using override-redirect to exclude the dialog from the WM's management entirely.

  • Comment on Re: Tk overrideredirect topwindow on top

Replies are listed 'Best First'.
Re^2: Tk overrideredirect topwindow on top
by Anonymous Monk on Oct 08, 2019 at 00:14 UTC
    If the dialog is being shown, meaning it should be on top of parent, simply have a Tk::after that keeps raising it, untils the dialog is withdrawn

      You might also be able to bind a handler for <Visibility> events and raise the window again if it becomes obscured, which avoids continuous graphics traffic (until two programs both try to do this and end up fighting over "on top" status).

      Is this a long-lived window or only a short-lived dialog box? Is this supposed to be a modal dialog? If so, grabbing the server may be appropriate.

        Hello jcb,

        I am not an expert on bindings. I just found the following

        $dialog -> bind('<Visibility>', sub {$dialog->raise;});

        which however doesn't seem to get activated if my main window gets the focus and hides the $dialog. Am I using it the wrong way? I searched on the Net quite a lot, but could find almost no examples in using this technique.

        PS: My $dialog window is a short-lived Frame. It is a ListBox+Text widget added to an Entry widget in order to perform a choice (the various drop-down menus do not fit my purpose. I need a new custom widget).

      Thank you for the suggestion. For the moment I went adding

      $dialog->repeat(10, sub { $dialog->raise; });

      which makes the GUI respond as intended