in reply to Re: Tk::DialogBox as the top window
in thread Tk::DialogBox as the top window

It is true that I don't have MainLoop, but I don't believe that was the issue. I observed more carefully, the DialogBox actually poped up, but it is not the top window, thus it is covered by the broswer window (as you said this is a filter ;-). If I minimize the broswer, then the DialogBox shows up (or click its icon to activate it, it also shows up).

This code works, the box pops up three times:

use Tk; my $mw = MainWindow->new(); for (1..3) { $mw->DialogBox(-title => "?", -buttons => ["Yes", "No"])->Show(); }

Which makes sense, as the "command prompt" window, from where I run my script, itself is the top window.

The question is how to bring the DialogBox to top front automatically.

CGI is an interesting answer. I like it. It requires more coding, but I am willing to go that way, if there is no way to bring the DialogBox to front.

Sort of don't like the idea of Win32 GUI. Would rather reduce platform dependency.

Replies are listed 'Best First'.
Re^3: Tk::DialogBox as the top window
by qumsieh (Scribe) on Oct 08, 2004 at 05:50 UTC
    the DialogBox actually poped up, but it is not the top window

    Usually, a

    $window->raise;
    raises your window, but in the case of a dialog, you might need to do something like:
    $mw->after(50, sub {$dialog->raise}); $dialog->Show;
    to schedule a callback to be executed after the dialog is shown. Untested :)

    Also, if you don't need your MainWindow, why don't you withdraw it?

Re^3: Tk::DialogBox as the top window
by tachyon (Chancellor) on Oct 08, 2004 at 04:54 UTC

    The problem you have is that the focus is with IE. You need to steal the focus to FG your dialog, then give it back. AFAK this means you have to deal with the window manager and as a result won't port transparently. Win32::GUITest for example shows you how to get focus on a Window from Perl. An alternative that still gives you a popup is to use a small javascript to generate your dialog box. You could pass it a hash and if you got the request+hash back in your filter call that a yes, otherwise....

    cheers

    tachyon