Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Win32::GUI questions

by HelenCr (Monk)
on Aug 24, 2012 at 01:15 UTC ( #989418=perlquestion: print w/ replies, xml ) Need Help??
HelenCr has asked for the wisdom of the Perl Monks concerning the following question:

Dear esteemed PerlMonks

I hope you can help me with the folowing Win32::GUI questions (for which I can't seem to find answers in the documentation):

a. GetOpenFileName(): It opens with the "List" option for the file list. How can I make it open with the "Details" option for the file list?

b. BrowseForFolder(): The window "hides" behind current windows on the desktop. Is there an option to "bring it to foreground" or "make it open as the top window"?

Many thanks in advance

Helen

Comment on Win32::GUI questions
Re: Win32::GUI questions
by kejohm (Hermit) on Aug 24, 2012 at 06:14 UTC
    1. As far as I can tell, the view for the Open Dialog box is based on the settings for Windows Explorer or any previous instances of the dialog box. So if you change the view in one dialog box and open another, the view should be remembered.

    2. You may need to specify an owner for the dialog box using the -owner parameter.

      a. As far as I can tell, the view for the Open Dialog box is based on the settings for Windows Explorer or any previous instances of the dialog box. So if you change the view in one dialog box and open another, the view should be remembered.

      The view settings are not remembered. I am on Windows XP Service Pack 3. Strawberry Perl.

      You may need to specify an owner for the dialog box using the -owner parameter.

      Can you give an example for the exact command?

      Many TIA, Helen

Re: Win32::GUI questions
by Corion (Pope) on Aug 24, 2012 at 06:21 UTC

    As you don't show any relevant code, I can only guess:

    For a. - the style the folder pops up is maintained by the OS / the user. In theory, the OS remembers the file picker style for the user.

    For b. - how do you call BrowseForFolder()? You can likely give it a "parent window" id, in front of which it pops up. If you pass 0, that means "desktop", which sounds like the symptoms you describe.

      Esteemed monks: thank you for your efforts.

      Here is the relevant excerpt from the code:

      use strict; use warnings; use 5.014; use Win32::Console; use Win32::GUI(); use autodie; use warnings qw< FATAL utf8 >; use Carp::Always; use Win32API::File::Time qw{:win}; use Image::ExifTool qw(:Public); use Date::Parse; # ... my ( $FileName, $ImageDir, $DIR, $TopDir); # ... $TopDir = 'D:\My Documents'; $ImageDir = Win32::GUI::BrowseForFolder( -root => $TopDir, -includ +efiles => 1,); unless ($ImageDir) { say '$DirName not defined after calling Win32::GUI::BrowseForF +older, ', 'Photo date set line'.__LINE__; exit; } else { say "Identified directory: $ImageDir"; } # now select a file $FileName = Win32::GUI::GetOpenFileName( -title => 'Select an ima +ge file', -directory => $ImageDir, -file => "\0" . " " x 256, -filter => ["Image files (*.jpg)" => "*.jpg;*.jpeg", "All file +s", "*.*", ],); unless ($FileName) { say '$FileName not defined after calling Win32::GUI::GetOpenFi +leName, ', 'Photo date set line'.__LINE__; } else { say "Identified image file: $FileName"; } # ...

      For a. - the style the folder pops up is maintained by the OS / the user. In theory, the OS remembers the file picker style for the user.

      How do you set up the style for the picker?

      For b. ... You can likely give it a "parent window" id, in front of which it pops up. If you pass 0, that means "desktop", which sounds like the symptoms you describe.

      I have posted the code. Can you please post an example how to do that right?

      Many TIA - Helen

Re: Win32::GUI questions
by Anonymous Monk on Aug 24, 2012 at 07:04 UTC
      you need to look on ddg://GetOpenFileName View Details site:microsoft.com

      Thank you. This is deep. It's the MSDN documentation.

      It seems that (in the GetOpenFileName dialog) in order to switch from the default "List" view to the required "Detail" view, you need to use the "hook function dialog". They only give (naturally) C++ and VBA examples. Can you explain how to apply those examples in Perl?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://989418]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2014-09-22 23:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (208 votes), past polls