B4J Question What Command To Use On Windows To Open A New Window Showing Directory

B4XDev

Member
Licensed User
I've searched the forum but couldn't find how to open a new OS window to a directory. Here's what I've tried:

B4X:
Private Sub btn_OpenFolder_Click
    'open the project folder
    Log("Opening the project folder: " & current_project_folder)
    shell.Initialize("shell","Open",Array(current_project_folder))
    shell.WorkingDirectory = current_project_folder
    shell.Run(-1)
End Sub

I've also tried "Start" as the Executable string in shell.Initialize.
 
Solution
B4X:
Sub Button1_Click
    Private fx as JFX ' if not already exists in the form...
    fx.ShowExternalDocument("C:\")
    fx.ShowExternalDocument("E:\B4J")
    fx.ShowExternalDocument("E:\ORC\ORC.Delphi\ORCStreamHelper\LSE3Teams")
End Sub

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Button1_Click
    Private fx as JFX ' if not already exists in the form...
    fx.ShowExternalDocument("C:\")
    fx.ShowExternalDocument("E:\B4J")
    fx.ShowExternalDocument("E:\ORC\ORC.Delphi\ORCStreamHelper\LSE3Teams")
End Sub
 
Last edited:
Upvote 0
Solution

B4XDev

Member
Licensed User
As you only can use this in a UI app a JFX Object is probably already there.

I was wondering if fx was usually global or not. Oh! Just found it in Main (in a B4XPages app).

It wasn't in the class module where I put the code, so I added it to the local Sub. Should I instead make a reference to the fx in Main? What's best practice?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…