Announcement

Collapse
No announcement yet.

Display Browse statement

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Display Browse statement

    I'm new to PB9, coming from VB6. I can't seem to get the Display Browse statement to work. If I just use the following code in my program...

    DISPLAY BROWSE 0, "Select Working Directory", "C:\DataFile\", _
    %BIF_NEWDIALOGSTYLE OR %BIF_USENEWUI OR %BIF_VALIDATE

    I get an Error 420 - Relational operator expected

    OK, so I make sFolder a local string variable and...
    sFolder = DISPLAY BROWSE 0, "Select Working Directory", "C:\DataFile\", _
    %BIF_NEWDIALOGSTYLE OR %BIF_USENEWUI OR %BIF_VALIDATE

    This generates an error 519 - Missing declaration: Browse

    Wait a minute. This is a PB9 function. I thought I did not have to declare it, or at least that's what the help files would lead you to believe.

    So then I got rid of the compiler directive DIM ALL and that generated an error 516 - DEFtype, Type ID or type-specifier (?%&!#$), or AS ... required : Browse

    At this point I'm taking a break and asking for help.
    Dave Paton

  • #2
    You can omit the optional parameters, but not the commas; otherwise, there is no way to ascertain which parameter you're omitting. Use this:

    Code:
       LOCAL strFolder AS STRING
       DISPLAY BROWSE 0, [B], ,[/B] "Select Working Directory", "C:\DataFile\", _
       %BIF_NEWDIALOGSTYLE OR %BIF_USENEWUI OR %BIF_VALIDATE TO strFolder
    Forum: http://www.jose.it-berater.org/smfforum/index.php

    Comment


    • #3
      You are also missing the "TO folder$" after the flags. Jose's example shows it.

      Just noticed that on your second try you had "sFolders =". I believe ??? this won't work if syntax shows "TO" at end. ????????????
      Last edited by Dale Yarker; 20 Sep 2008, 12:31 AM. Reason: just noticed...
      Dale

      Comment


      • #4
        Display Browse Statement

        OK, that worked. I was wondering what the TO folder was all about as it was not explained in the Help file example. But this dialog box only displays 11 lines of data. Is there any way to get an Explorer style dialog box to Browse for Folders that shows 3 columns of 15 lines of files. In VB6, I used the following code based on Microsoft Common Dialog control 6.0 (SP6)....

        dlgCom.DialogTitle = "Select the Surfer Working Directory" 'Titlebar caption
        dlgCom.InitDir = "C:\DataFile\Clients\"
        dlgCom.FileName = "Select a Directory" 'Put something in filenamebox
        dlgCom.Flags = cdlOFNNoValidate + cdlOFNHideReadOnly 'Set CD Flags
        'Here comes the big trick
        dlgCom.Filter = "Folders|*.~#!"
        sMyNewDirectory = CurDir$

        This code displays an Explorer style window with 45 files displayed. The filename box is hard coded to "Select a Directory" unless you change it to...

        dlgCom.FileName = CurDir$

        and then it will show the last clicked directory. The Save button will save the folder path to a vaiable sMyNewDirectory. Now I've tried this in FireFly and it displays OK but the Save button won't do anything. I'm starting to think that the only way to do this in either FF or PB9 is to access the Class ID or the interface ID of the MS Dialog. Once you've used the Explorer style dialog box, it seems to be going backwards to use an 11 line dialog box. The Display OpenFile statement has an Explorer flag, but neither the Display Save nor Display Browse statements do. Any chance of a future version of PB9 including these flags for these 2 statements?
        Last edited by Dave Paton; 20 Sep 2008, 08:16 PM.
        Dave Paton

        Comment


        • #5
          Using the following:
          Code:
          DISPLAY BROWSE 0, 10, 10, "", "", %BIF_EDITBOX OR %BIF_UAHINT OR %BIF_NEWDIALOGSTYLE _
                       OR %BIF_BROWSEINCLUDEFILES OR %BIF_VALIDATE TO billybob
          The dialog box displays with a button "Make New Folder".
          Clicking on the button does not make a new folder for me. I have cycled through the flags trying a lot of different combinations in this endeavour. There is no information on handling the button click, which I assume would be handled by the engine for the dialog box.

          Is there something that I haven't thought of here?
          Rod
          I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

          Comment


          • #6
            This works OK on my system (WinXP Home SP2).

            You can't create a new folder if the current folder selected in the tree view is an 'illegal' parent folder (like My Computer).
            In that case an error message is displayed, "You cannot create a new folder here. Choose a different location", anyway.
            Otherwise a "New Folder" is automatically created in the dialog's tree view with the name selected, ready to be edited.

            What I haven't figured out is what use is the edit box? Help says, %BIF_EDITBOX:
            "Includes an edit control in the dialog box that allows the user to type the name of an item".
            But it doesn't say what for! - It doesn't affect the displayed items nor is the typed contents of the edit box returned, even if it's a valid name?
            Code:
            #Dim All 
             
            Function PbMain()
             Dim billybob$
             
              DISPLAY BROWSE 0, 10, 10, "", "", %BIF_USENEWUI TO billybob
                IF LEN(billybob) THEN
                  MsgBox "Selected: "+billybob
                ELSE 
                  MsgBox "Cancelled"
                END If
             
            End Function
            Later:
            - OK %BIF_EDITBOX allows the user to type in a folder name using the full path. As the user start typing, a dropdown list of possible
            folder names is presented (possibly system option setting dependant). If the typed text is a valid Path\FolderName it is returned.
            Last edited by Dave Biggs; 28 Sep 2008, 03:14 AM. Reason: More info on BIF_EDITBOX
            Rgds, Dave

            Comment


            • #7
              Well, I don't know what to think.
              I took all the flags I had in the statement out and replaced it with the %BIF_USENEWUI that you used and it worked.
              So I put all the other flags back in one by one testing to see which of them stopped it from working, testing each one, and they all worked. So I took out the above and it still worked. Each time I was trying to make a folder in the PB90\Samples folder, where I'd been trying to do it before my last post. Now I have a whole bunch of "New Folder"s as which make a nice looking chain however impractical.
              Now my DISPLAY BROWSE needs a "Delete Folder" button.
              I'm running Vista Home Premium.

              Thanks for looking at it for me.
              Last edited by Rodney Hicks; 27 Sep 2008, 10:11 PM. Reason: additional info
              Rod
              I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

              Comment


              • #8
                Now my DISPLAY BROWSE needs a "Delete Folder" button.
                If you use the %BIF_NEWDIALOGSTYLE or the %BIF_USENEWUI styles, R-Click - "Delete" is available from within DISPLAY BROWSE
                Rgds, Dave

                Comment


                • #9
                  Cute! Never tried the right click thingy, I was so glad to see the folder made. Didn't think of deleting them until writing that post. Thanks again!
                  Rod
                  I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

                  Comment


                  • #10
                    The edit box is provided so the user may type in a value when you use the VALIDATE flag . Your application is then responsible for creating whatever 'item' might be returned if it does not yet exist.

                    Note that "if " DISPLAY BROWSE is a 'wrapper' for ShBrowseForFolder......

                    - You can, by adjusting style bits, display printers and/or files and/or computers in addition to folders.
                    - You can suppress the edit box by not using BIF_USENEWUI (which is BIF_EDITBOX OR BIF_NEWDIALOGSTYLE) and using instead only the BIF_NEWDIALOGSTYLE. In this case of course the user can only select something (folder, file, printer, computer) which already exists.

                    But ShBrowseForFolder () is not all that hard to use, and the callback options can be powerful; so you might just consider eschewing the use of DISPLAY BROWSE and handle your application using the direct call to the WinAPI function.

                    Power example: if you leave the edit box on the sceen and you specify a calback proc, you will get a BFFM_VALIDATEFAILED notification message in that callback procedure if he enters something invalid and you can 'do something' at that point.


                    MCM
                    Last edited by Michael Mattias; 28 Sep 2008, 08:39 AM.
                    Michael Mattias
                    Tal Systems (retired)
                    Port Washington WI USA
                    [email protected]
                    http://www.talsystems.com

                    Comment


                    • #11
                      What I didn't understand was that when the edit box is shown, it can act as a kind of 'keyboard navigation aid'. i.e. You can get to the folder that you want to select by typing rather than 'mousing'.

                      I found that you need to start by typing the path (what is currently highlighted is not taken as a starting point). Once you do start typing a valid path (e.g. 'C:\'), the system tries to predict your intention and presents a dropdown list which is updated with matching folders as you type.
                      (You can use the down arrow key to select one of the candidates, pressing enter makes that the selection that is returned).

                      I'm not sure how I expected the edit box to behave initially but now at least I can see how it can be used.
                      Your application is then responsible for creating whatever 'item' might be returned if it does not yet exist.
                      Actually from my tests, it looks as if the PB DISPLAY BROWSE doesn't return what was typed if it isn't already valid - whether the BIF_VALIDATE flag is set or not.

                      I guess if the user should be able to indicate a new folder is needed, the option to go to the API & ShBrowseForFolder might need to be explored.
                      Rgds, Dave

                      Comment

                      Working...
                      X