in reply to TK::Dialogbox geometry spec

If you read "perldoc Tk::Dialog" it states that all positioning is done by the Popup method, read "perldoc Tk::Popup". Popup positions are limited. If you want to move your dialog, you need to roll your own, with a toplevel window. It's not that hard, you just add a global grab.
#!/usr/bin/perl use warnings; use strict; use Tk; my $tl; my $mw = MainWindow->new; $mw->title( "MainWindow" ); $mw->Button( -text => "Toplevel", -command => \&do_Toplevel )->pack(); MainLoop; sub do_Toplevel { if ( !Exists( $tl ) ) { $tl = $mw->Toplevel(); $tl->geometry('300x100+100+100'); $tl->title( "Toplevel" ); #put all your widgets here $tl->Button( -text => "Close", -command => sub { $tl->grabRelease; $tl->withdraw } )->pack; } else { $tl->deiconify(); $tl->raise(); $tl->grabGlobal; } }

I'm not really a human, but I play one on earth CandyGram for Mongo

Replies are listed 'Best First'.
Re^2: TK::Dialogbox geometry spec
by kayl (Initiate) on Jul 09, 2008 at 20:00 UTC
    That's where I was headed. But there are two Dialog-widget-type features I couldn't figure out how to implement. 1) solved by the GRAB you demonstrated (thanks). 2):

    Dialog, messageBox and DialogBox widgets all suspend the routine calling them until the user deals with the popup.

    Toplevel does not. A new (Toplevel) window is spawned and the routine goes on its way.

    I need for the routine to wait until the box is closed and react to the data the user entered.

    Why? I'm looping through an array that points to records data. If a particular record is missing one or more fields, a window pops to ask for it. When it's been entered, the next window pops prompting for missing fields in subsequent records.

    As is, the mainwindow tries to spawn LOTS of windows (one for each record missing any fields) simultaneously (and bombs out).
      If I understand you correctly, you want a dialog type widget that returns some data, rather than an Ok, etc. You might want to look at Tk RGBColorDialog where I use a toplevel as a dialog with a data return value.

      I'm not really a human, but I play one on earth CandyGram for Mongo