Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

ui.browse_directory_dialog

francois
2014-07-24
2014-07-25
  • francois - 2014-07-24

    Hello,

    Is it possible that the path attribute of this method has no effect?
    In the code:

    filepath = system.ui.browse_directory_dialog("Select a directory", path=projectPath)
    

    Where projectPath is a valid string:

    C:\Users\francois\Documents\Software\Codesys\project
    

    The prompt has "My computer" selected.

    Thanks!

     
  • Anonymous - 2014-07-25

    Originally created by: M.Schaber

    Hello,

    I did test it with several pathes (on local harddisk and on a network drive) and it worked.

    It did not work, however, when trying an UNC path ("\servername\share\some\directory") or a path to a directory which does not exist, in both cases, it did show "My Computer".

    Does your project path directory actually exist?

    Internally, we're just using the .NET Framework FolderBrowserDialog, so the (a little bit weird) rules for its "SelectedPath" property also apply to the "path" parameter of our browse_directory_dialog function.

    One of the Rules is:

    Zitat:
    [...]as long as SelectedPath is an absolute path that is a subfolder of RootFolder (or more accurately, points to a subfolder of the shell namespace represented by RootFolder)

    different values for this parameter:

    from __future__ import print_function
    import System
    Β  Β 
    res = system.ui.browse_directory_dialog("Choose a directory", path="\\\\server01\\SomeShare\\some\\path", root_folder=System.Environment.SpecialFolder.Desktop)
    print("The user did choose: '%s'" % res)
    

    This value seemed to work also for network shares, but still not for non-existing pathes.

     
  • francois - 2014-07-25

    Thanks for your answer!

    Specifying the Desktop folder instead of MyComputer worked perfectly.

    Regards

     

Log in to post a comment.