in reply to Tk - Place DialogBox in middle of top window

You need the -geometry option, which is described here:
http://www.wellho.net/forum/The-Tcl-programming-language/Tk-Geometry-strings.html

To be able to place a dialog on top of another window, you'll need to use the winfo command to get the information. In Perl, you'll want to do something like:
$mw->winfo("geometry")

See all possible winfo strings here: http://www.wellho.net/forum/The-Tcl-programming-language/Tk-Geometry-strings.html

Replies are listed 'Best First'.
Re^2: Tk - Place DialogBox in middle of top window
by Dirk80 (Pilgrim) on Jul 06, 2010 at 14:10 UTC

    Hello,

    Thank you for your answer. To get the geometry information via winfo is working fine. So it is no problem to compute the geometry information I need to place the dialogbox in the middle of the main window.

    My problem is how can I set the geometry information to the dialogbox?

    I tried the following code:

    my $db = $mw->DialogBox(-title => "Status", -buttons => ['Cancel'], -geometry => "300x300x+100+100");

    I got this error:

    Tk::Error: Can't set -geometry to `300x300x+100+100' for Tk::DialogBox +=HASH(0x1d85574): unknown option "-geometry" at c:/Perl/site/lib/Tk/C +onfigure.pm line 46. at c:/Perl/site/lib/Tk/Derived.pm line 294

    Thank you for your help.

    Greetings,

    Dirk