slojuggler has asked for the wisdom of the Perl Monks concerning the following question:

Hello... 5 days ago I posted a continuation thread to this node: Re: Re: Modal Tk Toplevel/Passing a MainWindow

It hasn't received much traffic.


I have two questions:

1. Does anyone have any ideas on this node Re: Re: Modal Tk Toplevel/Passing a MainWindow

2. Should I have instead posted a fresh new post to SOPW instead of continued on the thread?

Thanks! --slojuggler

Replies are listed 'Best First'.
Re: Previously asked Tk question
by MZSanford (Curate) on Sep 21, 2001 at 13:42 UTC
    Well, here goes my info/opinion on the whole thing :

    1. You could probably use $widget->screenheight() and $widget->screenwidth(), taking into account your window size, and calculate a centering point. Then use $main->geometry() to move the window there.
    2. who am i to say :-)

    my own worst enemy
    -- MZSanford
Missed your question the first time...
by Rhose (Priest) on Sep 21, 2001 at 17:00 UTC
    I hope this snippet will help you.

    #-- Just for clarity, here is the hash array used in the snippet my %_MAINWIN = ( 'title' => 'Oracle User Manager for Baan ('.$_VERSION.')' +, 'width' => 790, 'height' => 565, 'row_height' => 25, 'radioratio' => 1.0, 'buttonratio' => 1.0, ); #-- Create and center the main window $mMainWindow = MainWindow->new; $mMainWindow->title($_MAINWIN{title}); $mWinX = int(($mMainWindow->screenwidth-$_MAINWIN{width})/2); $mWinY = int(($mMainWindow->screenheight-$_MAINWIN{height})/2); $mMainWindow->geometry ( $_MAINWIN{width} . 'x' . $_MAINWIN{height} . '+' . $mWinX . '+' . $mWinY ); $mMainWindow->resizable($_FALSE, $_FALSE);

    Anyway, the quick answer is centering is done with geometry. Please post here if you have additional questions (or if I missed the actual question. *Smiles*)

    Update Yeah, what MZSanford said... *Smiles*