spikey_wan has asked for the wisdom of the Perl Monks concerning the following question:
Does anyone know how to position the dialog boxes from Win32::FileOp. i.e. the OpenDialog, SaveAsDialog and BrowseForFolder dialog boxes?
They seem to be relative to the console window, so that if the console is not displayed, or is not there at all (i.e. I generated an .exe file with perlapp --gui), then they appear in the top left corner of the screen, but if the console IS displayed then they appear with their top left corner close to the top left of the console.
I really want them positioned relative to my main Tk window, like I can with everything else. I have a feeling that it may be something to do with the handle option, but adding '-handle => $mw' didn't seem to make any difference.
Thanks,
Spike.
UPDATE
Thanks to eserte, the updated code below now works for positioning the OpenDialog and SaveAsDialog relative to the main Tk window. Unfortunately it doesn't work on the BrowseForFolder dialog box. If I could just find a way to get it to work for that one, I could die happy! ;-)
Short demo:
use strict; use warnings; use Tk; use Win32::FileOp; my $mw = MainWindow -> new; $mw -> withdraw; my $windowid = hex ($mw -> id); my $openbutton = $mw -> Button ( -text => 'Open', -command => \&opensub, ) -> pack; my $savebutton = $mw -> Button ( -text => 'save', -command => \&savesub, ) -> pack; my $browsebutton = $mw -> Button ( -text => 'browse', -command => \&browsesub, ) -> pack; $mw -> Popup; MainLoop; sub opensub { my $file = OpenDialog(-title => "open", -handle => $windowid); } sub savesub { my $file = SaveAsDialog(-title => "save", -handle => $windowid); } sub browsesub { my $dir = BrowseForFolder ("no handle"); my $dir1 = BrowseForFolder("with handle", -handle => $windowid); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Win32::FileOp window positioning?
by halley (Prior) on Mar 18, 2004 at 15:32 UTC | |
by paulbort (Hermit) on Mar 18, 2004 at 17:26 UTC | |
Re: Tk::FileSelect or Tk::FBox as common file dialogs for Win32
by Brutha (Friar) on Mar 19, 2004 at 08:39 UTC | |
by spikey_wan (Scribe) on Mar 19, 2004 at 11:59 UTC | |
Re: Win32::FileOp window positioning?
by didier (Vicar) on Mar 19, 2004 at 09:03 UTC | |
by spikey_wan (Scribe) on Mar 19, 2004 at 11:50 UTC | |
Re: Win32::FileOp window positioning?
by eserte (Deacon) on Mar 19, 2004 at 09:36 UTC | |
by spikey_wan (Scribe) on Mar 19, 2004 at 14:35 UTC | |
by Jenda (Abbot) on Nov 09, 2004 at 17:32 UTC | |
by spikey_wan (Scribe) on Nov 09, 2004 at 18:11 UTC |