Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Windows Select File Dialog Box - UTILITY function with CHOOSEFILE

How do I display a modern Windows Select File Dialog Box? Using the Utility function with CHOOSEFILE I get something that looks like this:


Comments

  • edited June 2021
  • RTI OS Directory allows you to use the normal Windows file open dialog. https://wiki.srpcs.com/display/Commands/RTI+OS+Directory+function+Choose
  • Using RTI_OS_DIRECTORY will work to get the directory. I then have to make a popup of the files in the directory for the user to choose from.

    I thought that there must be a way to display a Windows Choose a File dialog box.
  • CHOOSEFILE is not purposefully showing that particular dialog. I use CHOOSEFILE all the time, and it always shows the default Open File dialog for Windows. What version of Windows? What version of OI? Are you running OI in Compatability mode?
  • I thought that the results I was getting were strange. I'm using OI 9.4.0 with Windows 10, NO Compatability mode.
    PARM=''
    PARM<1>=0 ; * 0=OPEN, 1=SAVE AS
    PARM<2>="All files (*.*)/*.*/"
    PARM<3>=1 ; * DEFAULT FILE TYPE IS THE FIRST ONE
    PARM<4>='' ; * DEFAULT FILENAME
    PARM<5>=0X200 ; * OFN_ALLOWMULTISELECT FROM THE MICROSOFT SDK
    PARM<6>='C:\ATTACHMENTS' ; * INITIAL DIRECTORY
    ATTACHMENT=UTILITY("CHOOSEFILE",@WINDOW,PARM)
  • I have code that's been the same for over a decade and other than PARM<5>, it's essentially the same as yours and like Kevin, I get the default Windows open file dialog.
    OI is 9.4.2 but I don't see that making any real difference.

    CFOpt = "" CFOpt<1> = 0 ;* open mode CFOpt<2> = "Text Files (*.csv)/*.csv/All Files (*.*)/*.*/" CFOpt<3> = 1 CFOpt<4> = DfltName CFOpt<6> = StartDir Filename = Utility("CHOOSEFILE", @window, CFOpt)

    Must be something else at play
  • So I added parm<5> for curiosity's sake and...

  • Good catch. If you want to use the multi-select flag, then you have to include the use-explorer-style flag, which is 0x80000. So, both flags together would be 0x80200.
  • Wow, it works! You guys are amazing.
Sign In or Register to comment.