in reply to Win32::FileOp window positioning?

Win32::FileOp::OpenOrSaveDialog() populates a Win32 data structure called an OPENFILENAME. It's a really crazy structure with a lot of seemingly unrelated data. One element is an HWND which refers to the "owner window."

I think the common file open dialog uses this field to center the dialog relative to that window, or that window's top level grandparent. If you don't populate it, the console window or the desktop itself are the only choices it would have.

If you provide a hash reference as an argument to Win32::FileOp::OpenDialog(), it will populate many parameters in the struct for you. For example, { -handle => $myDesiredHwnd } would fill that HWND parameter in the Win32 data structure. But the trick becomes figuring out the right hWnd value for that.

You'd have to look into your Windows build of Tk::MainWindow to see if it has a window handle you could retrieve.

Update: Sorry if this is greek-- the Tk::* folks want to be as generic as possible, while the Win32::* stuff tends to expose a lot of random capability like this. Exposing capability is fine, but it requires a lot more legwork to learn how it all applies or how to take advantage of it.

--
[ e d @ h a l l e y . c c ]

Replies are listed 'Best First'.
Re: Re: Win32::FileOp window positioning?
by paulbort (Hermit) on Mar 18, 2004 at 17:26 UTC